{"record":{"id":"4df9969eebd73d34","repo":"coleam00/Archon","slug":"error-mcperror-message","errorCode":null,"errorMessage":"❌ Error: ${mcpError.message}","messagePattern":"❌ Error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/providers/src/codex/provider.ts","lineNumber":743,"sourceCode":"          } else {\n            getLog().debug({ itemId: item.id, status: item.status }, 'file_change_no_changes');\n          }\n          break;\n        }\n\n        case 'mcp_tool_call': {\n          const server = item.server as string | undefined;\n          const tool = item.tool as string | undefined;\n          const mcpToolName = getMcpToolName(item);\n\n          if ((item.status as string) === 'failed') {\n            getLog().warn(\n              { server, tool, error: item.error, itemId: item.id },\n              'mcp_tool_call_failed'\n            );\n            const mcpError = item.error as { message?: string } | undefined;\n            const errMsg = mcpError?.message\n              ? `❌ Error: ${mcpError.message}`\n              : '❌ Error: MCP tool failed';\n            yield {\n              type: 'tool_result',\n              toolName: mcpToolName,\n              toolOutput: errMsg,\n              toolCallId: itemId,\n              toolOutcome: 'error',\n            };\n          } else {\n            let toolOutput = '';\n            const mcpResult = item.result as { content?: unknown } | undefined;\n            if (mcpResult?.content) {\n              if (Array.isArray(mcpResult.content)) {\n                toolOutput = JSON.stringify(mcpResult.content);\n              } else {\n                getLog().warn(\n                  {\n                    itemId: item.id,","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/providers/src/codex/provider.ts#L725-L761","documentation":"When a Codex MCP tool call reports item.error, streamCodexEvents does not throw; it yields a tool_result with toolOutcome 'error' whose output string is `❌ Error: <mcpError.message>`. The provider forwards the MCP server's own error text to the model as the tool result and logs 'mcp_tool_call_failed' with server, tool, error, and itemId for diagnosis.","triggerScenarios":"An MCP server invoked by Codex returns a failed tool call whose error object carries a message: the tool raised an exception server-side, its output was rejected, or the server reported a transport/auth problem for that specific call.","commonSituations":"MCP tool script exits nonzero or prints an error; the MCP server lacks permissions or files the tool needs; tool arguments rejected by the server's schema; the MCP server crashed mid-call; misconfigured MCP server command in the workflow node's declared MCP config.","solutions":["Check the 'mcp_tool_call_failed' log entry for the full error object, server name, and tool name.","Run the MCP server manually with the same arguments to reproduce the tool failure.","Verify the MCP server is correctly configured and its dependencies and permissions are in place.","Fix the underlying tool or its inputs; the model receives this message as the tool result and can adapt if the text is actionable."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before the workflow node runs\nconst serverOk = await spawnMcpServerHealthCheck(declaredMcpServer);\nif (!serverOk) throw new Error(`MCP server ${declaredMcpServer.command} failed to start`);","typeGuard":"function isMcpToolErrorResult(chunk: unknown): chunk is { type: 'tool_result'; toolOutcome: 'error'; toolOutput: string } {\n  const c = chunk as { type?: string; toolOutcome?: string };\n  return c?.type === 'tool_result' && c.toolOutcome === 'error';\n}","tryCatchPattern":"for await (const chunk of stream) {\n  if (isMcpToolErrorResult(chunk)) {\n    getLog().warn({ tool: chunk.toolName, output: chunk.toolOutput }, 'mcp_tool_failed_downstream');\n    // surface to the operator; the model already saw the error text\n  }\n}","preventionTips":["Smoke-test each declared MCP server's tools before adding them to workflow nodes.","Grant MCP servers the filesystem/permissions they need up front.","Validate tool arguments against the server's schema before calling.","Watch mcp_tool_call_failed logs for recurring per-server failures."],"tags":["mcp","codex","tooling"],"backgroundTag":"mcp-tool-call-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}