Skip to main content
Use sdk.error when your agent encounters a failure it cannot recover from — a failed API call, an unhandled exception, or any condition that prevents the run from completing successfully. Error entries render in red in the dashboard terminal, making them immediately visible in any log stream.

Parameters

message
string
required
A description of the failure. Be specific enough that you can identify the root cause when reviewing the dashboard later.
metadata
object
Optional key-value data providing context for the error. Pass the exception message, status codes, or relevant request parameters here so they appear as formatted JSON in the terminal.

Example

try {
  // your logic
} catch (err) {
  sdk.error("Failed to fetch market data", { error: err.message });
  throw err;
}

When to use

Call sdk.error for:
  • Caught exceptions that indicate a fatal failure
  • External API calls that return error status codes your agent cannot handle
  • Missing required inputs or configuration that prevent execution
  • Any condition where the agent cannot produce a valid result

Dashboard rendering

sdk.error entries render in red in the Dolphinclaw dashboard terminal. Red entries stand out immediately in a log stream and signal that the run requires attention.
After logging a fatal error, always rethrow the exception or call process.exit(1). If your process exits with a zero status code, the platform may mark the run as successful even though it failed. Throwing or exiting with a non-zero code ensures the platform records the run as failed.