{"record":{"id":"1d563643b49403d8","repo":"iflytek/astron-agent","slug":"workflow-mcp-server-registry-failed","errorCode":"WORKFLOW_MCP_SERVER_REGISTRY_FAILED","errorMessage":"WORKFLOW_MCP_SERVER_REGISTRY_FAILED","messagePattern":"WORKFLOW_MCP_SERVER_REGISTRY_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java","lineNumber":5906,"sourceCode":"        List<JSONObject> jsonObjects = new ArrayList<>();\n        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();\n\n        // Read all JSON files under the path\n        org.springframework.core.io.Resource[] resources = null;\n        try {\n            resources = resolver.getResources(mcpServerFilePath + \"/*.json\");\n\n            for (org.springframework.core.io.Resource resource : resources) {\n                try (InputStream inputStream = resource.getInputStream()) {\n                    // Read file content and convert to JSONObject;\n                    JSONObject jsonObject = JSON.parseObject(inputStream, JSONObject.class);\n\n                    jsonObjects.add(jsonObject);\n                }\n            }\n        } catch (IOException e) {\n            log.error(\"Failed to read file for MCP-Server registration, file path={}\", mcpServerFilePath, e);\n            throw new BusinessException(ResponseEnum.WORKFLOW_MCP_SERVER_REGISTRY_FAILED);\n        }\n\n        return jsonObjects;\n    }\n\n    public void removeAllCanvasHold() {\n        // Clear canvas multi-open count\n        Long wc = count(Wrappers.lambdaQuery(Workflow.class).eq(Workflow::getDeleted, false));\n        Long l = redisUtil.removeScan(\"spark_bot:workflow:canvas_heartbeat:*\", Math.toIntExact(wc));\n        log.info(\"remove all canvas count {}\", l);\n    }\n}\n","sourceCodeStart":5888,"sourceCodeEnd":5919,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L5888-L5919","documentation":"Thrown by WorkflowService when reading the MCP server definition file fails during MCP-Server registration. The code reads a JSON file from mcpServerFilePath and parses entries; any IOException while reading the file is logged and converted to WORKFLOW_MCP_SERVER_REGISTRY_FAILED.","triggerScenarios":"MCP-Server registration runs while the configured mcpServerFilePath does not exist, is unreadable (permissions), points to a directory, or the underlying stream/reader throws an IOException (disk I/O error, missing mount).","commonSituations":"Deployment missing the MCP server definition file; wrong file path in configuration; Kubernetes/Docker volume not mounted; file permission changed after deploy.","solutions":["Verify mcpServerFilePath is configured correctly and the file exists on the service host/container","Check file read permissions for the service user","Confirm the config/volume mounting (docker-compose or helm) includes the MCP server definitions file","Re-deploy or restore the missing file, then retry the registration"],"exampleFix":"// before: registration assumes file exists\nList<JSONObject> jsonObjects = readMcpServerFile(mcpServerFilePath);\n// after: check before invoking registration flow\nFile f = new File(mcpServerFilePath);\nif (!f.isFile() || !f.canRead()) {\n    log.error(\"MCP server definition file missing or unreadable: {}\", mcpServerFilePath);\n    return;\n}\nList<JSONObject> jsonObjects = readMcpServerFile(mcpServerFilePath);","handlingStrategy":"validation","validationCode":"File f = new File(mcpServerFilePath);\nif (!f.isFile() || !f.canRead()) {\n    throw new IllegalStateException(\"MCP server definition file missing/unreadable: \" + mcpServerFilePath);\n}","typeGuard":null,"tryCatchPattern":"try {\n    workflowService.registerMcpServers();\n} catch (BusinessException e) {\n    if (\"WORKFLOW_MCP_SERVER_REGISTRY_FAILED\".equals(e.getCode())) {\n    // verify file path config and volume mount, then retry\n    }\n}","preventionTips":["Add a startup health check asserting the MCP definition file exists and is readable","Verify volume mounts in docker-compose/helm before rollout","Keep file paths in one validated config source"],"tags":["file-io","mcp","configuration"],"backgroundTag":"file-read-failed","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"}