{"record":{"id":"d4924121921993ea","repo":"iflytek/astron-agent","slug":"action-cot-runner","errorCode":null,"errorMessage":"无效的插件名称'{action}'","messagePattern":"无效的插件名称'(.+?)'","errorType":"exception","errorClass":"CotFormatIncorrectExc","httpStatus":null,"severity":"warning","filePath":"core/agent/engine/nodes/cot/cot_runner.py","lineNumber":191,"sourceCode":"        action_marker = self._find_marker(step_content, \"action\")\n        action_input_marker = self._find_marker(step_content, \"action_input\")\n        if (\n            action_marker is None\n            or action_input_marker is None\n            or action_marker.end() > action_input_marker.start()\n        ):\n            raise cot_exc.CotFormatIncorrectExc(\"无效的推理格式，Action字段不完整\")\n\n        thought = \"\"\n        thought_marker = self._find_marker(step_content, \"thought\")\n        if thought_marker is not None and thought_marker.end() <= action_marker.start():\n            thought = step_content[thought_marker.end() : action_marker.start()].strip()\n\n        action = step_content[action_marker.end() : action_input_marker.start()].strip()\n        action = action.strip(\"`*_\")\n\n        if not await self.is_valid_plugin(action):\n            raise cot_exc.CotFormatIncorrectExc(f\"无效的插件名称'{action}'\")\n\n        action_input_end = len(step_content)\n        observation_marker = self._find_marker(step_content, \"observation\")\n        if (\n            observation_marker is not None\n            and observation_marker.start() >= action_input_marker.end()\n        ):\n            action_input_end = observation_marker.start()\n        action_input_raw = step_content[\n            action_input_marker.end() : action_input_end\n        ].strip()\n        action_input = await self._parse_action_input(action_input_raw)\n        return thought, action, action_input\n\n    async def parse_cot_step(\n        self, step_content: str, allow_plain_final_answer: bool = False\n    ) -> CotStep:\n        final_answer_marker = self._find_marker(step_content, \"final_answer\")","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/agent/engine/nodes/cot/cot_runner.py#L173-L209","documentation":"After extracting the Action name between the Action and Action Input markers, parse_cot_step validates it via is_valid_plugin(action). If the name does not match any registered/available plugin, it raises CotFormatIncorrectExc '无效的插件名称' (invalid plugin name). This prevents dispatching tool calls to nonexistent plugins.","triggerScenarios":"The model hallucinates a tool name, uses a display name/alias not in the registry, misspells a plugin name, or calls a plugin not enabled for the current agent/space.","commonSituations":"Prompt lists tools in a different naming scheme than the registry; plugin disabled or removed but still described in the prompt; model inventing tools like 'google_search' when only built-ins exist; case/underscore mismatches.","solutions":["Keep the tool list in the system prompt generated dynamically from the actual plugin registry so names always match.","Validate the prompt's tool descriptions/names against is_valid_plugin for each; remove stale entries.","Add fuzzy/retry handling: on this exception, re-prompt with the list of valid plugin names.","Check agent/plugin configuration to ensure the intended plugin is installed and enabled for the tenant."],"exampleFix":"// before (prompt hardcodes stale name)\nAction: web_search_v1\n// after (names from registry)\nAvailable plugins: baidu_search, amap_weather ...\nAction: baidu_search","handlingStrategy":"retry","validationCode":"valid_names = {p.name for p in agent.plugins}\n# assert every tool name mentioned in the system prompt is in valid_names","typeGuard":null,"tryCatchPattern":"try:\n    step = await runner.parse_cot_step(content)\nexcept CotFormatIncorrectExc as e:\n    if \"无效的插件名称\" in str(e):\n        content = await reprompt_with_valid_plugin_list(e, messages)\n    raise","preventionTips":["Generate the tool list in the prompt from the live plugin registry.","Remove disabled/renamed plugins from the prompt promptly.","Re-prompt with valid names on failure instead of failing the turn."],"tags":["llm","cot","plugin-registry","agent"],"backgroundTag":"resource-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}