iflytek/astron-agent · error · PluginExc
40023
40023
Error message
Failed to get link tool protocol
What it means
GetToolSchemaExc raised in LinkPluginRunner.tool_schema_list (link.py:254). The link-plugin HTTP service responded with HTTP 200 but its business payload has code != 0, meaning the remote plugin rejected the tool-schema-list request. The wrapper converts that business-level failure into a single opaque plugin exception with code 40023 and message 'Failed to get link tool protocol'; the upstream error detail is only visible in the printed result / span events.
Solutions
- Check the span event 'link-plugin-tool-schema-list-outputs' and the printed `result` to read the real error code/message returned by the link plugin.
- Verify LINK plugin endpoint env vars and credentials (app_id, uid, tool_id, version) are correct and not expired.
- Confirm the link plugin service is healthy (logs/health endpoint) and retry the request.
- Confirm agent and link plugin API versions are compatible; redeploy or upgrade the plugin service if the protocol changed.
Example fix
// before: opaque re-raise hides remote detail
if result.get("code") != 0:
raise GetToolSchemaExc
// after: carry the remote code/message for debugging
if result.get("code") != 0:
raise GetToolSchemaExc(
f"link tool schema list failed: code={result.get('code')} msg={result.get('message')}"
) Defensive patterns
Strategy: try-catch
Validate before calling
if not (app_id and uid and tool_id and version):
raise ValueError("link plugin credentials/app_id/tool_id/version must be set before tool_schema_list") Type guard
def is_valid_schema_payload(resp: dict) -> bool:
return isinstance(resp, dict) and resp.get("code") == 0 and isinstance(resp.get("data", {}).get("tools", []), list) Try / catch
try:
tools = await runner.tool_schema_list(span)
except GetToolSchemaExc as e:
logger.error("link tool schema list failed: %s", e)
tools = [] # or re-raise depending on criticality Prevention
- Keep link plugin app_id/uid/tool_id/version in validated config, checked at startup
- Monitor link plugin service health and alert on non-zero business codes
- Log the remote response body before re-raising so the real cause is diagnosable
- Pin agent/link plugin API versions together in deployment
When it happens
Trigger: Calling BasePlugin.parse_react_schema_list -> LinkPluginRunner.tool_schema_list, POSTing to the link plugin's schema-list endpoint, and receiving a JSON body whose 'code' field is not 0 (e.g. auth rejection, invalid app_id/tool_id, plugin-internal error).
Common situations: Expired or wrong link-plugin credentials (app_id/uid), the link plugin service being partially degraded while still returning 200 with an error code, tool_id not existing on the remote side, or version mismatch between agent and link plugin API.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/9dc7c74cedeeac03.
Report an issue: GitHub.
Appendix: source
Thrown at core/agent/service/plugin/link.py:254
tl_id = tool_id.get("tool_id", "")
tl_version = tool_id.get("version", "")
url += "&tool_ids=" + tl_id + "&versions=" + tl_version
sp.add_info_events(attributes={"link-plugin-tool-schema-list-inputs": url})
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
response.raise_for_status()
if response.status == 200:
result = await response.json()
sp.add_info_events(
attributes={
"link-plugin-tool-schema-list-outputs": (
json.dumps(result, ensure_ascii=False)
)
}
)
print(result)
if result.get("code") != 0:
raise GetToolSchemaExc
tools_data = result.get("data", {}).get("tools", [])
return tools_data if isinstance(tools_data, list) else []
sp.add_info_events(
attributes={
"link-plugin-tool-schema-list-outputs": (
f"response code is {response.status}"
)
}
)
raise GetToolSchemaExc
@staticmethod
def parse_request_query_schema(
query_schema: list[dict[str, Any]],
) -> tuple[dict[str, dict[str, Any]], set[str]]:
"""Parse parameters"""
View on GitHub (pinned to 5e758547a8)