{"record":{"id":"ec51f9ed071bdfa5","repo":"iflytek/astron-agent","slug":"failed-to-build-runner","errorCode":null,"errorMessage":"Failed to build runner","messagePattern":"Failed to build runner","errorType":"exception","errorClass":"AgentInternalExc","httpStatus":null,"severity":"critical","filePath":"core/agent/api/v1/base_api.py","lineNumber":208,"sourceCode":"        self, node_trace_log: NodeTraceLog, meter: Meter, span: Span\n    ) -> AsyncGenerator[str, None]:\n\n        with span.start(\"RunRunner\") as sp:\n            chunk_logs: List[str] = []\n            context = RunContext(\n                error=AgentNormalExc(),\n                error_log=\"\",\n                chunk_logs=chunk_logs,\n                span=sp,\n                node_trace_log=node_trace_log,\n                meter=meter,\n            )\n\n            try:\n                try:\n                    runner = await self.build_runner(sp)\n                    if runner is None:\n                        raise AgentInternalExc(\"Failed to build runner\")\n\n                    runner_stream = runner.run(span=sp, node_trace_log=node_trace_log)\n                    if inspect.isawaitable(runner_stream):\n                        runner_stream = await runner_stream\n                    async with aclosing(runner_stream):\n                        async for chunk in runner_stream:\n                            chunk.id = span.sid\n                            processed_stream = self._process_chunk(chunk, chunk_logs)\n                            async with aclosing(processed_stream):\n                                async for processed_chunk in processed_stream:\n                                    yield processed_chunk\n\n                except BaseExc as exc:\n                    context.error = exc\n                    context.error_log = traceback.format_exc()\n                except Exception as exc:  # pylint: disable=broad-exception-caught\n                    context.error = AgentInternalExc(str(exc))\n                    context.error_log = traceback.format_exc()","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/agent/api/v1/base_api.py#L190-L226","documentation":"Raised in run_runner when build_runner(sp) returns None or throws, wrapped as AgentInternalExc('Failed to build runner'). It signals that the agent runner could not be constructed for the given span/params, so the stream cannot start.","triggerScenarios":"Calling the run/stream endpoint where build_runner returns None because the agent/plugin/model config is missing or invalid, or build_runner raises an internal exception that is converted into this generic failure.","commonSituations":"Model provider credentials not configured; plugin referenced by the agent is unavailable; invalid agent configuration saved in the console; dependency initialization failing at runtime.","solutions":["Inspect the logs/span for the underlying exception raised inside build_runner and fix that root cause","Verify the agent's model and plugin configuration exists and is valid for the requesting space","Confirm required credentials (API keys, endpoints) for the configured model provider are present","Re-deploy/restart the agent service if a plugin or dependency failed to initialize"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    runner = await build_runner(sp)\nexcept Exception as e:\n    logger.exception(\"runner build failed\")\n    return error_response(500, \"Failed to build runner\", cause=str(e))","preventionTips":["Validate agent model/plugin configuration before invoking the run endpoint","Ensure model provider credentials are present in the environment","Add health checks that exercise build_runner on service startup"],"tags":["runner","initialization","internal-error"],"backgroundTag":"internal-invariant-violation","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}