apache/shardingsphere · error · FileNotFoundException
MCP configuration file `%s` does not exist.
Error message
MCP configuration file `%s` does not exist.
What it means
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.
Source
Thrown at mcp/bootstrap/src/main/java/org/apache/shardingsphere/mcp/bootstrap/config/loader/MCPConfigurationLoader.java:68
return new YamlMCPLaunchConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlMCPLaunchConfiguration.class));
}
private static File resolveConfigurationFile(final String configPath) throws FileNotFoundException {
String actualConfigPath = configPath.trim();
ShardingSpherePreconditions.checkNotEmpty(actualConfigPath, () -> new FileNotFoundException("MCP configuration path cannot be blank."));
Path directPath = Paths.get(actualConfigPath).normalize();
if (Files.exists(directPath)) {
return directPath.toFile();
}
Path currentPath = Paths.get("").toAbsolutePath();
while (null != currentPath) {
Path candidatePath = currentPath.resolve(actualConfigPath).normalize();
if (Files.exists(candidatePath)) {
return candidatePath.toFile();
}
currentPath = currentPath.getParent();
}
throw new FileNotFoundException(String.format("MCP configuration file `%s` does not exist.", actualConfigPath));
}
}
View on GitHub (pinned to e952770a21)
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.
Example fix
# before (run from /opt, config is in /opt/mcp) java -jar mcp.jar --config mcp-config.yaml # FileNotFoundException # after java -jar mcp.jar --config /opt/mcp/mcp-config.yaml
Defensive patterns
Strategy: validation
Validate before calling
Path p = Paths.get(configPath).toAbsolutePath().normalize();
if (!Files.isRegularFile(p)) throw new FileNotFoundException("Config not found: " + p); Try / catch
try { File cfg = loader.load(configPath); } catch (final FileNotFoundException ex) { /* resolve to an absolute path that exists and retry */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- System property `%s` must be a positive integer, but was `%s
- 2
- Failed to start %s server.
- Failed to start embedded Tomcat runtime.
- Duplicate rule tag `!%s` in file `%s`
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/dd6ffa5404ca8f4e.
Report an issue: GitHub.