{"record":{"id":"2de21c71f4d7ba93","repo":"apache/seatunnel","slug":"no-agent-yaml-found-use-config-path-to-agent-y","errorCode":null,"errorMessage":"No agent.yaml found. Use --config /path/to/agent.yaml, set ENV_EDGE_AGENT_CONFIG, or place config/agent.yaml under the working directory.","messagePattern":"No agent\\.yaml found\\. Use --config /path/to/agent\\.yaml, set ENV_EDGE_AGENT_CONFIG, or place config/agent\\.yaml under the working directory\\.","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":51,"sourceCode":"    public static Path resolve(Path explicitConfigPath) throws IOException {\n        if (explicitConfigPath != null) {\n            return requireRegularFile(explicitConfigPath);\n        }\n\n        String env = System.getenv(EdgeAgentEnvConstants.ENV_EDGE_AGENT_CONFIG);\n        if (env != null && !env.trim().isEmpty()) {\n            return requireRegularFile(Paths.get(env.trim()));\n        }\n\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":33,"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#L33-L66","documentation":"EdgeAgentConfigLocator.resolve() searches --config, the ENV_EDGE_AGENT_CONFIG environment variable, and config/agent.yaml under the working directory; if none yields a regular file it throws FileNotFoundException telling the user all three resolution paths failed. This is the agent's startup configuration discovery failing.","triggerScenarios":"Starting the agent without --config, with ENV_EDGE_AGENT_CONFIG unset or pointing to a missing file, and no config/agent.yaml in the working directory.","commonSituations":"Running the starter from the wrong working directory; forgetting to set the env var in a container or systemd unit; a typo in the --config path; deploying without copying agent.yaml.","solutions":["Pass an explicit path: --config /absolute/path/to/agent.yaml","Set ENV_EDGE_AGENT_CONFIG to a valid agent.yaml path in the environment","Copy agent.yaml into ./config/agent.yaml relative to the working directory","Verify the resolved file exists and is a regular file (not a directory) with ls"],"exampleFix":"// before\nsh bin/edge-agent.sh\n// after\nsh bin/edge-agent.sh --config /opt/agent/config/agent.yaml","handlingStrategy":"validation","validationCode":"Path cfg = Paths.get(configPath);\nif (!Files.isRegularFile(cfg)) {\n    throw new IllegalArgumentException(\"agent.yaml not found: \" + cfg);\n}","typeGuard":"boolean isRegularFile(Path p) { return p != null && Files.isRegularFile(p.toAbsolutePath().normalize()); }","tryCatchPattern":"try {\n    locator.resolve(args);\n} catch (FileNotFoundException e) {\n    LOG.error(\"Agent config missing: {}\", e.getMessage());\n    System.exit(2);\n}","preventionTips":["Always pass --config with an absolute path in scripts/containers","Set ENV_EDGE_AGENT_CONFIG in service definitions","Keep config/agent.yaml present in the deployment working directory"],"tags":["startup","configuration","file-not-found"],"backgroundTag":"config-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"}