apache/seatunnel · error · FileNotFoundException

Agent config file not found: ${normalized}

Error message

Agent config file not found: ${normalized}

What it means

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.

Source

Thrown at seatunnel-edge-agent/seatunnel-edge-agent-starter/src/main/java/org/apache/seatunnel/edge/agent/starter/command/EdgeAgentConfigLocator.java:60

        Path cwd = Paths.get("").toAbsolutePath();
        for (String candidate : new String[] {"config/agent.yaml", "agent.yaml"}) {
            Path path = cwd.resolve(candidate).normalize();
            if (Files.isRegularFile(path)) {
                LOG.debug("Using agent config: {}", path);
                return path;
            }
        }
        throw new FileNotFoundException(
                "No agent.yaml found. Use --config /path/to/agent.yaml, set "
                        + EdgeAgentEnvConstants.ENV_EDGE_AGENT_CONFIG
                        + ", or place config/agent.yaml under the working directory.");
    }

    private static Path requireRegularFile(Path path) throws FileNotFoundException {
        Path normalized = path.toAbsolutePath().normalize();
        if (!Files.isRegularFile(normalized)) {
            throw new FileNotFoundException("Agent config file not found: " + normalized);
        }
        LOG.debug("Using agent config: {}", normalized);
        return normalized;
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Correct the path so it names the agent.yaml file itself, not a directory
  2. Verify with ls -l that the target exists and is a regular file
  3. Fix or remove the broken symlink and redeploy the config file
  4. Check ENV_EDGE_AGENT_CONFIG is not set to a stale path in the deployment environment

Example fix

// before
--config /opt/agent/config/
// after
--config /opt/agent/config/agent.yaml
Defensive patterns

Strategy: validation

Validate before calling

Path p = Paths.get(userSupplied);
if (!Files.isRegularFile(p.toAbsolutePath().normalize())) {
    throw new IllegalArgumentException("Not a regular file: " + userSupplied);
}

Type guard

boolean isConfigFile(Path p) { return p != null && Files.isRegularFile(p.toAbsolutePath().normalize()); }

Try / catch

try {
    locator.resolve(args);
} catch (FileNotFoundException e) {
    LOG.error("Check --config points to the file itself, not a directory: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Passing --config or ENV_EDGE_AGENT_CONFIG pointing to a path that is a directory, a symlink to nothing, or a nonexistent file.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/cd209b69b0037d74. Report an issue: GitHub.