{"record":{"id":"d63607d91c3574cf","repo":"n8n-io/n8n","slug":"error-message-d63607","errorCode":null,"errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/Ollama/actions/router.ts","lineNumber":41,"sourceCode":"\t\t\tbreak;\n\t\tcase 'text':\n\t\t\texecute = text[ollamaTypeData.operation].execute;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new NodeOperationError(this.getNode(), `The resource \"${resource}\" is not supported!`);\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tconst responseData = await execute.call(this, i);\n\t\t\treturnData.push.apply(returnData, responseData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { error: error.message }, pairedItem: { item: i } });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\titemIndex: i,\n\t\t\t\tdescription: error.description,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn [returnData];\n}\n","sourceCodeStart":23,"sourceCodeEnd":50,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/Ollama/actions/router.ts#L23-L50","documentation":"Per-item catch in the Ollama router's execute loop. When continueOnFail is off, any error from the selected operation's execute callback is re-thrown as a NodeOperationError annotated with itemIndex and the original error's description; the original message is preserved. Ollama errors typically originate from a local/self-hosted Ollama server.","triggerScenarios":"Ollama operation threw for item i — model not pulled/available on the server, connection refused/timeout to the Ollama host, model returned an error, image input missing or unsupported by the model. With continueOnFail on, the error is captured into the item's JSON instead.","commonSituations":"Ollama server URL wrong or down in credentials; named model not yet pulled (`ollama pull <model>`); input item missing the binary field expected by an image-capable model; Ollama version too old for the requested feature; one bad item aborts a batch with continueOnFail off.","solutions":["Read error.message for the underlying Ollama error.","Verify the Ollama host/base URL in credentials is reachable and the model is pulled.","Enable 'Continue On Fail' on the node if partial success is acceptable.","Inspect the item at error.itemIndex and confirm required fields/binaries are present.","Update Ollama server to a version that supports the requested operation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-validate the Ollama host and model availability before the execute loop,\n// since most Ollama errors stem from server/model issues rather than input data.\nasync function preflightOllama(this: IExecuteFunctions, model: string): Promise<string | null> {\n  const creds = await this.getCredentials('ollamaApi').catch(() => null);\n  if (!creds || !(creds as { url?: string }).url) return 'Ollama credentials are missing a URL';\n  return null;\n}\nfunction validateOllamaItem(item: INodeExecutionData, resource: string, operation: string): string | null {\n  if (!item || typeof item !== 'object') return 'item is missing';\n  if (resource === 'image' && !item.json?.image && !item.binary?.data) {\n    return 'image operation requires an image input (json.image or binary.data)';\n  }\n  return null;\n}","typeGuard":"function isItemIndexError(e: unknown): e is NodeOperationError & { itemIndex: number } {\n  return e instanceof NodeOperationError && typeof (e as { itemIndex?: number }).itemIndex === 'number';\n}","tryCatchPattern":"for (let i = 0; i < items.length; i++) {\n  try {\n    const responseData = await execute.call(this, i);\n    returnData.push.apply(returnData, responseData);\n  } catch (error) {\n    if (this.continueOnFail()) {\n      returnData.push({ json: { error: (error as Error).message }, pairedItem: { item: i } });\n      continue;\n    }\n    throw new NodeOperationError(this.getNode(), error, { itemIndex: i });\n  }\n}","preventionTips":["Confirm the Ollama server URL in credentials is reachable and the named model is pulled (`ollama pull <model>`).","Enable 'Continue On Fail' on the node when running batches where some items may be invalid.","Pre-validate each item has the fields/binaries the chosen operation expects.","Keep the Ollama server version current for the operations you use."],"tags":["ollama","router","item-error","continue-on-fail","self-hosted"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}