{"record":{"id":"ca8527f4c6e94de6","repo":"apache/incubator-seata","slug":"file-not-found","errorCode":null,"errorMessage":"file not found","messagePattern":"file not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"config/seata-config-core/src/main/java/org/apache/seata/config/file/YamlFileConfig.java","lineNumber":45,"sourceCode":"import java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.HashMap;\nimport java.util.Map;\n\n@LoadLevel(name = FileConfigFactory.YAML_TYPE, order = 1, scope = Scope.PROTOTYPE)\npublic class YamlFileConfig implements FileConfig {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(YamlFileConfig.class);\n    private final Map<String, Object> configMap = new HashMap<>();\n\n    public YamlFileConfig(File file, String name) throws IOException {\n        Yaml yaml = new Yaml();\n        try (InputStream is = new FileInputStream(file)) {\n            flattenConfig(\"\", yaml.loadAs(is, HashMap.class), configMap);\n        } catch (FileNotFoundException e) {\n            throw new IllegalArgumentException(\"file not found\");\n        }\n    }\n\n    private void flattenConfig(String prefix, Map<String, Object> config, Map<String, Object> flatMap) {\n        for (Map.Entry<String, Object> entry : config.entrySet()) {\n            String key = prefix.isEmpty() ? entry.getKey() : prefix + \".\" + entry.getKey();\n            Object value = entry.getValue();\n            if (value != null) {\n                if (value instanceof Map) {\n                    flattenConfig(key, (Map<String, Object>) value, flatMap);\n                } else {\n                    flatMap.put(key, String.valueOf(value));\n                }\n            }\n        }\n    }\n\n    @Override","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/config/seata-config-core/src/main/java/org/apache/seata/config/file/YamlFileConfig.java#L27-L63","documentation":"YamlFileConfig's constructor throws IllegalArgumentException('file not found') when opening the given File raises FileNotFoundException. Seata selects a YAML parser (via FileConfigFactory YAML_TYPE) when the config file name ends in .yml/.yaml; if the resolved File object does not point to an existing readable file, FileInputStream fails and this wrapper error surfaces during configuration bootstrap.","triggerScenarios":"Config file name set to a .yml path that does not exist on the filesystem or classpath resolution produced a wrong path; the file was present at build time but excluded from the deployed jar; relative path resolved against a different working directory (e.g. running seata from a service wrapper); file exists but is unreadable/permissions or is a directory.","commonSituations":"application.yml named in file.conf's config.file.name but missing from Docker image; -Dseata.config.name=path/to/config.yml with a typo; Kubernetes ConfigMount path differing from the configured name; moving from file.conf to registry.yml and forgetting to ship the file.","solutions":["Verify the exact path: log File.getAbsolutePath() before loading and confirm the file exists there.","Fix the configured name (config.file.name / seata.config.name) to point at the shipped .yml file.","If loading from the classpath, ensure the yml is under src/main/resources so it lands in the artifact.","For external files, use absolute paths or the 'file:' prefix supported by the resolver."],"exampleFix":"# before\nseata.config.name = classpath:application.yml  # file missing from resources\n\n# after\n# add src/main/resources/application.yml to the artifact, or point to an absolute path\nseata.config.name = file:/etc/seata/application.yml","handlingStrategy":"validation","validationCode":"File f = new File(path);\nif (!f.isFile() || !f.canRead()) {\n    throw new IllegalStateException(\"config file missing or unreadable: \" + f.getAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Log the absolute config path at startup to catch working-directory issues","Include yml config files in the built artifact (verify Docker image / jar contents)","Use absolute paths or the file: prefix for external config files in containers"],"tags":["config","yaml","file-not-found","startup","seata"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}