iflytek/astron-agent · warning · CotFormatIncorrectExc
无效的插件名称
Error message
无效的插件名称'{action}' What it means
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.
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.
Example fix
// before (prompt hardcodes stale name) Action: web_search_v1 // after (names from registry) Available plugins: baidu_search, amap_weather ... Action: baidu_search
Defensive patterns
Strategy: retry
Validate before calling
valid_names = {p.name for p in agent.plugins}
# assert every tool name mentioned in the system prompt is in valid_names Try / catch
try:
step = await runner.parse_cot_step(content)
except CotFormatIncorrectExc as e:
if "无效的插件名称" in str(e):
content = await reprompt_with_valid_plugin_list(e, messages)
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/d4924121921993ea.
Report an issue: GitHub.
Appendix: source
Thrown at core/agent/engine/nodes/cot/cot_runner.py:191
action_marker = self._find_marker(step_content, "action")
action_input_marker = self._find_marker(step_content, "action_input")
if (
action_marker is None
or action_input_marker is None
or action_marker.end() > action_input_marker.start()
):
raise cot_exc.CotFormatIncorrectExc("无效的推理格式,Action字段不完整")
thought = ""
thought_marker = self._find_marker(step_content, "thought")
if thought_marker is not None and thought_marker.end() <= action_marker.start():
thought = step_content[thought_marker.end() : action_marker.start()].strip()
action = step_content[action_marker.end() : action_input_marker.start()].strip()
action = action.strip("`*_")
if not await self.is_valid_plugin(action):
raise cot_exc.CotFormatIncorrectExc(f"无效的插件名称'{action}'")
action_input_end = len(step_content)
observation_marker = self._find_marker(step_content, "observation")
if (
observation_marker is not None
and observation_marker.start() >= action_input_marker.end()
):
action_input_end = observation_marker.start()
action_input_raw = step_content[
action_input_marker.end() : action_input_end
].strip()
action_input = await self._parse_action_input(action_input_raw)
return thought, action, action_input
async def parse_cot_step(
self, step_content: str, allow_plain_final_answer: bool = False
) -> CotStep:
final_answer_marker = self._find_marker(step_content, "final_answer")View on GitHub (pinned to 5e758547a8)