{"record":{"id":"cd209b69b0037d74","repo":"apache/seatunnel","slug":"agent-config-file-not-found-normalized","errorCode":null,"errorMessage":"Agent config file not found: ${normalized}","messagePattern":"Agent config file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"seatunnel-edge-agent/seatunnel-edge-agent-starter/src/main/java/org/apache/seatunnel/edge/agent/starter/command/EdgeAgentConfigLocator.java","lineNumber":60,"sourceCode":"\n        Path cwd = Paths.get(\"\").toAbsolutePath();\n        for (String candidate : new String[] {\"config/agent.yaml\", \"agent.yaml\"}) {\n            Path path = cwd.resolve(candidate).normalize();\n            if (Files.isRegularFile(path)) {\n                LOG.debug(\"Using agent config: {}\", path);\n                return path;\n            }\n        }\n        throw new FileNotFoundException(\n                \"No agent.yaml found. Use --config /path/to/agent.yaml, set \"\n                        + EdgeAgentEnvConstants.ENV_EDGE_AGENT_CONFIG\n                        + \", or place config/agent.yaml under the working directory.\");\n    }\n\n    private static Path requireRegularFile(Path path) throws FileNotFoundException {\n        Path normalized = path.toAbsolutePath().normalize();\n        if (!Files.isRegularFile(normalized)) {\n            throw new FileNotFoundException(\"Agent config file not found: \" + normalized);\n        }\n        LOG.debug(\"Using agent config: {}\", normalized);\n        return normalized;\n    }\n}\n","sourceCodeStart":42,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-edge-agent/seatunnel-edge-agent-starter/src/main/java/org/apache/seatunnel/edge/agent/starter/command/EdgeAgentConfigLocator.java#L42-L66","documentation":"EdgeAgentConfigLocator.requireRegularFile() normalizes the candidate path and throws FileNotFoundException when it exists but is not a regular file (or does not exist). resolve() calls this after picking up a user-supplied path from --config or the environment variable.","triggerScenarios":"Passing --config or ENV_EDGE_AGENT_CONFIG pointing to a path that is a directory, a symlink to nothing, or a nonexistent file.","commonSituations":"Pointing --config at the config/ directory instead of agent.yaml; a broken symlink after redeployment; a stale env var left from a previous container image; typo in the file name.","solutions":["Correct the path so it names the agent.yaml file itself, not a directory","Verify with ls -l that the target exists and is a regular file","Fix or remove the broken symlink and redeploy the config file","Check ENV_EDGE_AGENT_CONFIG is not set to a stale path in the deployment environment"],"exampleFix":"// before\n--config /opt/agent/config/\n// after\n--config /opt/agent/config/agent.yaml","handlingStrategy":"validation","validationCode":"Path p = Paths.get(userSupplied);\nif (!Files.isRegularFile(p.toAbsolutePath().normalize())) {\n    throw new IllegalArgumentException(\"Not a regular file: \" + userSupplied);\n}","typeGuard":"boolean isConfigFile(Path p) { return p != null && Files.isRegularFile(p.toAbsolutePath().normalize()); }","tryCatchPattern":"try {\n    locator.resolve(args);\n} catch (FileNotFoundException e) {\n    LOG.error(\"Check --config points to the file itself, not a directory: {}\", e.getMessage());\n}","preventionTips":["Point --config at agent.yaml, never at a directory","Check symlinks resolve to real files after deployment","Audit env vars for stale config paths in images"],"tags":["startup","configuration","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}