{"record":{"id":"899eb93cc5b2fdb9","repo":"iflytek/astron-agent","slug":"codeconvert-sparklinkcode-code","errorCode":"CodeConvert.sparkLinkCode(code)","errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/plugin_tool/link_client.py","lineNumber":311,"sourceCode":"                    CodeEnum.SPARK_LINK_CONNECTION_ERROR,\n                    err_msg=\"Tool request failed, connection error\",\n                    cause_error=\"Tool request failed, connection error\",\n                ) from e\n            except Exception as e:\n                # Handle other exceptions\n                raise e\n\n            await link_tool_span.add_info_events_async(\n                {\"link_response\": json.dumps(link_response, ensure_ascii=False)}\n            )\n\n            # Process response and handle errors\n            code = link_response[\"header\"][\"code\"]\n            message = link_response[\"header\"][\"message\"]\n\n            if code != 0:\n                # Handle tool execution errors\n                raise CustomException(\n                    err_code=CodeConvert.sparkLinkCode(code),\n                    err_msg=message,\n                    cause_error=json.dumps(link_response, ensure_ascii=False),\n                )\n            else:\n                # Extract and parse successful response\n                tool_response_text = link_response[\"payload\"][\"text\"][\"text\"]\n                return json.loads(tool_response_text)\n\n\nclass Link:\n    \"\"\"\n    Link system client for managing and executing plugin tools.\n\n    This class handles communication with the Link system to retrieve tool schemas\n    and manage tool execution. It parses OpenAPI schemas and creates Tool instances\n    for each available operation.\n    \"\"\"","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/plugin_tool/link_client.py#L293-L329","documentation":"After calling the Spark Link tool, run() checks the response header code; a non-zero code is converted via CodeConvert.sparkLinkCode and raised as a CustomException carrying the server-supplied message. This is an application-level error returned by the Link API itself — the HTTP call succeeded but the tool execution failed on the server side.","triggerScenarios":"run() executes a Link tool and the response body link_response[\"header\"][\"code\"] is any value other than 0.","commonSituations":"Invalid or expired Link credentials, tool disabled on the Link platform, malformed tool input rejected by the service, or Link-side rate limiting/quota exhaustion.","solutions":["Read the message and cause_error in the exception to see the Link server's error description","Validate the tool input parameters against the tool schema before calling run()","Check Link API credentials/authorization and the tool's status on the Link platform; fix the reported cause and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# validate tool inputs against the fetched tool schema before run()\njsonschema.validate(tool_input, tool_schema)","typeGuard":null,"tryCatchPattern":"try:\n    result = link_client.run(...)\nexcept CustomException as e:\n    log.error(\"Link API error\", extra={\"cause\": e.cause_error})\n    # inspect e.cause_error for server-side code/message","preventionTips":["Validate tool inputs against the OpenAPI schema before calling","Keep Link credentials and tool status verified","Log cause_error for every failure to speed diagnosis"],"tags":["api","http","spark-link"],"backgroundTag":"api-error-response","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"}