{"record":{"id":"b9aab4f8592b8254","repo":"Mintplex-Labs/anything-llm","slug":"llm-processing-failed-error-message","errorCode":null,"errorMessage":"LLM processing failed: ${error.message}","messagePattern":"LLM processing failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agentFlows/executors/llm-instruction.js","lineNumber":43,"sourceCode":"\n    let completion;\n    const provider = aibitat.getProviderForConfig(aibitat.defaultProvider);\n    if (provider.supportsAgentStreaming) {\n      completion = await provider.stream(\n        [{ role: \"user\", content: input }],\n        [],\n        null\n      );\n    } else {\n      completion = await provider.complete([{ role: \"user\", content: input }]);\n    }\n\n    introspect(`Successfully received LLM response`);\n    if (resultVariable) config.resultVariable = resultVariable;\n    return completion.textResponse;\n  } catch (error) {\n    logger(`LLM processing failed: ${error.message}`, error);\n    throw new Error(`LLM processing failed: ${error.message}`);\n  }\n}\n\nmodule.exports = executeLLMInstruction;\n","sourceCodeStart":25,"sourceCodeEnd":48,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/agentFlows/executors/llm-instruction.js#L25-L48","documentation":"The catch wrapper in executeLLMInstruction: the configured LLM provider's complete() call threw, and the error is re-raised prefixed 'LLM processing failed: <message>'. The underlying message is the real diagnosis — invalid API key, unknown model, context-length exceeded, timeout, or an unreachable local endpoint — and it is also written via logger before the throw.","triggerScenarios":"An Agent Flow LLM Instruction block executing when the workspace's selected LLM provider fails: missing/expired provider API key, model name not available to the account, prompt plus input exceeding the model's context window, local LLM server (ollama/lmstudio) down, or provider timeout/overload (429/5xx).","commonSituations":"Workspace LLM key rotated but not updated; using a model string the provider renamed or deprecated; large scraped/variable content stuffed into the prompt blowing the token limit; AnythingLLM Docker container cannot reach a localhost LLM running on the host; free-tier quota exhausted mid-flow.","solutions":["Read the suffix after 'LLM processing failed:' — 401 means bad key, 404 model not found, 429 quota/rate, ECONNREFUSED means the endpoint is unreachable.","Open the same workspace model in regular chat to confirm the provider works outside the flow.","Shrink the input (shorter variables, shorter instruction) if the error mentions context length/tokens.","For local models, make sure the provider base URL is reachable from the AnythingLLM process/container."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function llmProviderHealthy(workspace) {\n  try {\n    const provider = await getWorkspaceProvider(workspace);\n    const r = await provider.complete([{ role: \"user\", content: \"ping\" }]);\n    return Boolean(r.textResponse);\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"async function llmStepWithRetry(exec, attempts = 3) {\n  for (let i = 0; i < attempts; i++) {\n    try {\n      return await exec();\n    } catch (e) {\n      if (!e.message.startsWith(\"LLM processing failed:\" ) || i === attempts - 1) throw e;\n      const cause = e.message.split(\"LLM processing failed:\")[1];\n      if (/401|403|model|context|token/i.test(cause)) throw e; // not transient\n      await new Promise((r) => setTimeout(r, 2 ** i * 1000));\n    }\n  }\n}","preventionTips":["Smoke-test the workspace's LLM with a tiny prompt before running flows that chain LLM steps.","Keep flow inputs bounded (trim variables) so prompts can't blow the context window.","Retry only transient suffixes (429/5xx/timeout); auth and model errors never resolve on retry."],"tags":["llm","agent-flows","provider","context-length","error-wrapping"],"backgroundTag":"llm-provider-error","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}