{"record":{"id":"7cdb026dff0c0b5f","repo":"quarkusio/quarkus","slug":"file-p-does-not-exist","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/catalog/CatalogMapperHelper.java","lineNumber":85,"sourceCode":"            serialize(mapper, catalog, writer);\n        }\n    }\n\n    public static void serialize(Object catalog, Writer writer) throws IOException {\n        serialize(mapper(), catalog, writer);\n    }\n\n    public static void serialize(ObjectMapper mapper, Object catalog, Writer writer) throws IOException {\n        mapper.writeValue(writer, catalog);\n    }\n\n    public static <T> T deserialize(Path p, Class<T> t) throws IOException {\n        return deserialize(mapperForPath(p), p, t);\n    }\n\n    public static <T> T deserialize(ObjectMapper mapper, 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.readValue(reader, t);\n        }\n    }\n\n    public static <T> T deserialize(InputStream is, Class<T> t) throws IOException {\n        return deserialize(mapper(), is, t);\n    }\n\n    public static <T> T deserialize(ObjectMapper mapper, InputStream is, Class<T> t) throws IOException {\n        return mapper.readValue(is, t);\n    }\n\n    public static <T> T deserialize(Reader reader, Class<T> t) throws IOException {\n        return deserialize(mapper(), reader, t);\n    }\n","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/catalog/CatalogMapperHelper.java#L67-L103","documentation":"CatalogMapperHelper.deserialize(ObjectMapper, Path, Class) guards all catalog JSON deserialization with a Files.exists(p) check and throws IllegalArgumentException when the file is missing. The library expects every catalog/registry JSON artifact (platform, non-platform, categories) to be materialized on disk before mapping.","triggerScenarios":"Calling deserialize()/deserialize(mapper, p, t) (e.g. ExtensionCatalog.fromFile, CodeCatalog, recommendations loading) with a Path that does not exist — typically a downloaded artifact that failed to land, a wrong local path, or a cache dir that was cleared.","commonSituations":"Pointing a resolver at a local JSON file whose path is mistyped; Maven artifact download skipped/failed but code proceeds; stale cache references after ~/.m2 or registry-cache cleanup; relative path resolved against unexpected working directory.","solutions":["Check Files.exists(path) and print the absolute path to verify the expected location.","Fix the path/coordinates so the catalog file actually exists (mvn resolve or re-download the artifact).","Repopulate the cache (clear and re-run resolution) if a cached path is stale.","Use the ObjectMapper deserialize variant only after ensuring the file was written, or handle IllegalArgumentException explicitly."],"exampleFix":"// before\nvar catalog = CatalogMapperHelper.deserialize(mapper, jsonPath, ExtensionCatalogImpl.class);\n// after\nif (!Files.exists(jsonPath)) {\n    jsonPath = downloadCatalog(artifactCoords); // materialize first\n}\nvar catalog = CatalogMapperHelper.deserialize(mapper, jsonPath, ExtensionCatalogImpl.class);","handlingStrategy":"validation","validationCode":"// Java\nimport java.nio.file.*;\nif (p == null || !Files.isRegularFile(p)) {\n    throw new IllegalStateException(\"Catalog file missing: \" + (p == null ? \"null\" : p.toAbsolutePath()));\n}","typeGuard":null,"tryCatchPattern":"// Java\ntry {\n    T catalog = CatalogMapperHelper.deserialize(mapper, p, clazz);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"File \") && e.getMessage().endsWith(\" does not exist\")) {\n        // materialize/redownload the file at path e.getMessage() refers to\n    }\n    throw e;\n}","preventionTips":["Print toAbsolutePath() of catalog paths when debugging — relative paths depend on CWD.","Verify the artifact actually downloaded before deserializing.","After clearing ~/.m2 or the registry cache, re-run resolution before touching cached files.","Check for proxies storing HTML error pages as .json artifacts."],"tags":["filesystem","json","missing-file"],"backgroundTag":"file-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}