Skip to main content

HarnessError

workflow.HarnessError is the standard error class used by the business workflow and runtime. It keeps the error type, node name, metadata, and cleaned cause, which eventually goes into the execution report.

Signature​

new workflow.HarnessError(options: ErrorOptions)

Parameter​

ParameterTypeDescription
optionsErrorOptionsStandard error configuration, including error type, message, node name, cause, and metadata.

ErrorOptions​

FieldDescription
typeMisclassification. Required.
messageError messages visible to users and reports. Required.
nodeNameThe associated node name. runtime is replenished when node execution fails.
causeOriginal error. Only safe fields are preserved during serialization.
metadataDebuggable structured information.

ErrorType​

TypeCommon SourcesDescription
input_validationParameter parsing, input node, file nodeInvalid input or missing configuration.
execution_abortedabort signal, timeout, execution restrictionsExecution was interrupted.
user_input_requiredUser input node, tool approvalworkflow Pause Wait to resume input.
tool_permission_deniedTool Permission Policy, Approval DenyThe current run does not allow the tool to be called.
node_executionNormal node execution failedAn unknown error thrown by a normal node.
provider_callLLM provider parse or callMissing provider, binding error, or call failure.
project_executionworkflow run failedworkflow Main process failed.
stream_interruptedstreaming node or provider streamStreaming output is interrupted or failed.

Instance field​

FieldTypeDescription
name"HarnessError"The Error name.
messagestringThe error message.
typeErrorTypeMisclassification.
nodeNamestring | undefinedThe associated node.
metadataobject | undefinedAdditional debugging information.
safeCauseErrorCause | undefinedThe sanitized cause, carrying name, message, statusCode, url, isRetryable, responseBody, a nested cause, and validation. responseBody is an excerpt of the upstream HTTP response body: whitespace-collapsed, redacted for credential-shaped values, and truncated to 200 characters. Call errors that carry only a status phrase such as Unauthorized gain a response <excerpt> detail in the run report so the status phrase cannot hide the real reason.

serialization structure​

FieldTypeDescription
typeErrorTypeMisclassification.
messagestringThe error message.
nodeNamestring | undefinedThe associated node.
metadataobject | undefinedAdditional information.
causeErrorCause | undefinedKeep only the safe cause field.

Error Code Mapping​

Running the report maps the failure type to payload errCode.

Error TypeerrCode
input_validation400
user_input_required202
tool_permission_denied403
execution_aborted499
stream_interrupted499
provider_call502
node_execution500
project_execution500

Example​

throw new workflow.HarnessError({
type: "input_validation",
message: "message is required.",
nodeName: "parse-input",
metadata: {
field: "message",
},
});

When to use​

SceneRecommendation
Illegal user inputThrow input_validation.
External service call failedThrow provider_call or let the provider layer wrap.
Want the report to retain structured contextUse metadata.
Common Unknown ExceptionCan be thrown directly,runtime will be wrapped as HarnessError.