{"record":{"id":"a5aa8541ca3b33f1","repo":"quarkusio/quarkus","slug":"file-p-does-not-exist-a5aa85","errorCode":null,"errorMessage":"File ${p} does not exist","messagePattern":"File (.+?) does not exist","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/config/RegistriesConfigMapperHelper.java","lineNumber":67,"sourceCode":"        if (!Files.exists(p.getParent())) {\n            Files.createDirectories(p.getParent());\n        }\n        try (BufferedWriter writer = Files.newBufferedWriter(p)) {\n            mapper(p).writeValue(writer, config);\n        }\n    }\n\n    public static void toJson(Object config, Writer writer) throws IOException {\n        jsonMapper().writeValue(writer, config);\n    }\n\n    public static void toYaml(Object config, Writer writer) throws IOException {\n        yamlMapper().writeValue(writer, config);\n    }\n\n    public static <T> T deserialize(Path p, Class<T> t) throws IOException {\n        if (!Files.exists(p)) {\n            throw new IllegalArgumentException(\"File \" + p + \" does not exist\");\n        }\n        try (BufferedReader reader = Files.newBufferedReader(p)) {\n            return mapper(p).readValue(reader, t);\n        }\n    }\n\n    public static <T> T deserializeYaml(InputStream is, Class<T> t) throws IOException {\n        return yamlMapper().readValue(is, t);\n    }\n\n    public static <T> T deserializeYaml(Reader reader, Class<T> t) throws IOException {\n        return yamlMapper().readValue(reader, t);\n    }\n}\n","sourceCodeStart":49,"sourceCodeEnd":82,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/config/RegistriesConfigMapperHelper.java#L49-L82","documentation":"RegistriesConfigMapperHelper.deserialize(Path p, Class<T>) reads and parses a registry config file, but first requires the file to exist; passing a path that is not an existing regular file throws this IllegalArgumentException. It is a precondition check so callers get a clear message rather than a NoSuchFileException buried in YAML parsing.","triggerScenarios":"Calling deserialize(p, RegistriesConfig.class) with a path that was never created, was deleted, or is a directory/symlink to a nonexistent target; locating a config path yourself and passing it in without an existence check.","commonSituations":"Custom tooling loading registries.yaml from a user-supplied path; tests pointing at a fixture file that is not on the test classpath/working directory; first-run scenarios where no default config has been generated yet.","solutions":["Check Files.exists(path) before calling deserialize and handle the missing case (use locateConfigYaml/createDefault if appropriate)","Correct the path in the calling code — print path.toAbsolutePath() to confirm where it actually resolves","Generate the config file if it should exist (e.g. by writing the default config before deserializing)"],"exampleFix":"// before\nRegistriesConfig cfg = RegistriesConfigMapperHelper.deserialize(path, RegistriesConfig.class);\n// after\nif (!Files.exists(path)) {\n    path = RegistriesConfigLocator.locateConfigYaml(null);\n}\nRegistriesConfig cfg = RegistriesConfigMapperHelper.deserialize(path, RegistriesConfig.class);","handlingStrategy":"validation","validationCode":"if (p == null || !Files.isRegularFile(p)) {\n    p = RegistriesConfigLocator.locateConfigYaml(null);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return RegistriesConfigMapperHelper.deserialize(p, RegistriesConfig.class);\n} catch (IllegalArgumentException | IOException e) {\n    logger.warn(\"Cannot read registry config {}: {}\", p, e.getMessage());\n    return RegistriesConfigLocator.createDefault();\n}","preventionTips":["Always obtain the path from RegistriesConfigLocator rather than constructing it by hand","Check Files.isRegularFile (not just exists) to avoid directories","Create a default config on first run before attempting to deserialize"],"tags":["config","filesystem","illegal-argument","deserialization"],"backgroundTag":"config-file-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}