{"record":{"id":"dd6ffa5404ca8f4e","repo":"apache/shardingsphere","slug":"mcp-configuration-file-s-does-not-exist","errorCode":null,"errorMessage":"MCP configuration file `%s` does not exist.","messagePattern":"MCP configuration file `(.+?)` does not exist\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"mcp/bootstrap/src/main/java/org/apache/shardingsphere/mcp/bootstrap/config/loader/MCPConfigurationLoader.java","lineNumber":68,"sourceCode":"        return new YamlMCPLaunchConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlMCPLaunchConfiguration.class));\n    }\n    \n    private static File resolveConfigurationFile(final String configPath) throws FileNotFoundException {\n        String actualConfigPath = configPath.trim();\n        ShardingSpherePreconditions.checkNotEmpty(actualConfigPath, () -> new FileNotFoundException(\"MCP configuration path cannot be blank.\"));\n        Path directPath = Paths.get(actualConfigPath).normalize();\n        if (Files.exists(directPath)) {\n            return directPath.toFile();\n        }\n        Path currentPath = Paths.get(\"\").toAbsolutePath();\n        while (null != currentPath) {\n            Path candidatePath = currentPath.resolve(actualConfigPath).normalize();\n            if (Files.exists(candidatePath)) {\n                return candidatePath.toFile();\n            }\n            currentPath = currentPath.getParent();\n        }\n        throw new FileNotFoundException(String.format(\"MCP configuration file `%s` does not exist.\", actualConfigPath));\n    }\n}\n","sourceCodeStart":50,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/mcp/bootstrap/src/main/java/org/apache/shardingsphere/mcp/bootstrap/config/loader/MCPConfigurationLoader.java#L50-L71","documentation":"MCPConfigurationLoader resolves the configuration path by first checking it directly and then walking from the current working directory up through every parent, resolving the relative path at each level. If no candidate exists, it throws FileNotFoundException('MCP configuration file `%s` does not exist.') naming the original path string.","triggerScenarios":"Starting the MCP bootstrap with a --config path (relative or absolute) that does not exist on disk and is not found in any ancestor of the process working directory; e.g. running the jar from a different directory than where the config file lives.","commonSituations":"Launching from systemd/Docker where the working directory differs from the development one; typos in the path; file mounted at a different location in a container; config file omitted from the deployment bundle.","solutions":["Pass an absolute path to the configuration file.","If relative, run the process from the directory containing the file or an ancestor of it (the loader only searches upward from cwd).","Verify with ls/test that the file exists at the exact path given, in the environment that runs the process.","In containers, double-check volume mounts land the file at the expected path.","Fix typos including file extension and case sensitivity on Linux."],"exampleFix":"# before (run from /opt, config is in /opt/mcp)\njava -jar mcp.jar --config mcp-config.yaml   # FileNotFoundException\n\n# after\njava -jar mcp.jar --config /opt/mcp/mcp-config.yaml","handlingStrategy":"validation","validationCode":"Path p = Paths.get(configPath).toAbsolutePath().normalize();\nif (!Files.isRegularFile(p)) throw new FileNotFoundException(\"Config not found: \" + p);","typeGuard":null,"tryCatchPattern":"try { File cfg = loader.load(configPath); } catch (final FileNotFoundException ex) { /* resolve to an absolute path that exists and retry */ }","preventionTips":["Pass absolute config paths to the MCP bootstrap.","Remember the loader only searches cwd upward — launch from the right directory.","Verify the file exists in the actual runtime environment (container mounts, systemd WorkingDirectory).","Use exact, case-correct file names on Linux."],"tags":["mcp","configuration","file-not-found","startup","path"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}