{"record":{"id":"15c17868142d029c","repo":"n8n-io/n8n","slug":"error-description-error-message","errorCode":null,"errorMessage":"error?.description || error?.message","messagePattern":"error\\?\\.description \\|\\| error\\?\\.message","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/Guardrails/actions/process.ts","lineNumber":70,"sourceCode":"\tconst handleFailedResults = (results: GroupedGuardrailResults): GuardrailUserResult[] => {\n\t\tconst unexpectedError = results.failed.find(\n\t\t\t(result) =>\n\t\t\t\tresult.status === 'rejected' ||\n\t\t\t\t(result.status === 'fulfilled' && result.value.executionFailed),\n\t\t);\n\n\t\tif (results.failed.length && operation === 'sanitize') {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'Failed to sanitize text', {\n\t\t\t\tdescription: mapGuardrailErrorsToMessage(results.failed),\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t\tif (unexpectedError && !this.continueOnFail()) {\n\t\t\tconst error =\n\t\t\t\tunexpectedError.status === 'rejected'\n\t\t\t\t\t? unexpectedError.reason\n\t\t\t\t\t: unexpectedError.value.originalException;\n\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\tdescription: error?.description || error?.message,\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t\treturn results.failed.map(mapGuardrailResultToUserResult);\n\t};\n\n\tconst stageGuardrails: StageGuardRails = {\n\t\tpreflight: [],\n\t\tinput: [],\n\t};\n\n\tconst checkModelAvailable = (model: BaseChatModel | null): model is BaseChatModel => {\n\t\tif (!model) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'Chat Model is required');\n\t\t}\n\t\treturn true;\n\t};","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/Guardrails/actions/process.ts#L52-L88","documentation":"This is the dynamic description of a NodeOperationError thrown by the Guardrails process handler when an 'unexpectedError' guardrail result occurs and continueOnFail is false. The thrown error's message is the underlying reason/originalException object, and its description falls back to error?.description then error?.message. It surfaces a guardrail that rejected or reported executionFailed for a reason other than a normal tripwire.","triggerScenarios":"handleFailedResults() finds the first result with status === 'rejected' OR (fulfilled with value.executionFailed). With continueOnFail() false, it extracts the reason (rejected) or originalException (fulfilled) and throws NodeOperationError(node, error, { description }). Fires when a guardrail check promise rejects (network/model/runtime failure) or when a guardrail explicitly marks executionFailed.","commonSituations":"An LLM-backed guardrail whose model request fails (rate limit, bad credentials, timeout); a guardrail throwing on unexpected input shape; a guardrail dependency error; transient API errors surfacing through the guardrail runtime.","solutions":["Read the underlying error.message/description to identify whether it is a model/auth/network failure versus a guardrail logic failure.","For transient model/API errors, retry the execution or fix credentials/connection for the upstream model.","If the specific guardrail is non-essential, disable it or move it to a stage that tolerates failure.","Enable 'Continue On Fail' on the node to let the workflow proceed and capture the failed item instead of aborting."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await runGuardrails(...);\n} catch (e) {\n  if (e instanceof NodeOperationError && e.description) {\n    // log description, decide retry vs fallback\n  }\n}","preventionTips":["Stabilize upstream model connections to avoid executionFailed results.","Enable Continue On Fail where partial results are acceptable.","Log the underlying description to distinguish transient vs logic failures."],"tags":["guardrails","node-operation","error-wrapping","unexpected"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}