{"record":{"id":"ae89534bbb17dfe5","repo":"quarkusio/quarkus","slug":"failed-to-parse-extensionfile","errorCode":null,"errorMessage":"Failed to parse ${extensionFile}","messagePattern":"Failed to parse (.+?)","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java","lineNumber":624,"sourceCode":"        }\n        if (artifactNode == null || groupId == null || artifactId == null || version == null) {\n            final ArtifactCoords coords = ArtifactCoords.jar(\n                    groupId == null ? project.getGroupId() : groupId,\n                    artifactId == null ? project.getArtifactId() : artifactId,\n                    version == null ? project.getVersion() : version);\n            extObject.put(\"artifact\", coords.toString());\n        }\n    }\n\n    private static String getRealValueOrNull(String s, String propertyExpr) {\n        return s != null && !s.isBlank() && !s.equals(propertyExpr) ? s : null;\n    }\n\n    private ObjectNode readExtensionDescriptorFile(Path extensionFile, ObjectMapper mapper) throws MojoExecutionException {\n        try (InputStream is = Files.newInputStream(extensionFile)) {\n            return mapper.readValue(is, ObjectNode.class);\n        } catch (IOException io) {\n            throw new MojoExecutionException(\"Failed to parse \" + extensionFile, io);\n        }\n    }\n\n    private void completeCodestartArtifact(ObjectMapper mapper, ObjectNode extObject) throws MojoExecutionException {\n        JsonNode mvalue = getJsonElement(extObject, METADATA, \"codestart\");\n        if (mvalue == null || !mvalue.isObject()) {\n            return;\n        }\n        final ObjectNode codestartObject = (ObjectNode) mvalue;\n        mvalue = mvalue.get(\"artifact\");\n        if (mvalue == null) {\n            if (!skipCodestartValidation) {\n                throw new MojoExecutionException(\"Codestart artifact is missing from the \" + extensionFile);\n            }\n            return;\n        }\n\n        String codestartArtifact = getCodestartArtifact(mvalue.asText(), project.getVersion());","sourceCodeStart":606,"sourceCodeEnd":642,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java#L606-L642","documentation":"readExtensionDescriptorFile reads the external extension descriptor file (extensionFile parameter) with Jackson into an ObjectNode. Any IOException — file missing, unreadable, or malformed JSON — is wrapped in a MojoExecutionException naming the file path, so the developer sees \"Failed to parse <path>\".","triggerScenarios":"Executing extension-descriptor with a configured extensionFile that does not exist, cannot be opened, or contains invalid JSON that Jackson cannot map to ObjectNode.","commonSituations":"Wrong relative/absolute path for extensionFile config; truncated or hand-broken extension.json (trailing commas, stray text); BOM/encoding issues; file deleted between configuration and execution in CI.","solutions":["Verify the extensionFile path exists and is readable (ls the exact path printed)","Validate the JSON content (jq . extension.json) and fix syntax errors","Check the wrapped IOException cause — FileNotFoundException vs JsonParseException — to distinguish path vs content problems"],"exampleFix":"// before: extension.json with trailing comma\n{ \"name\": \"myext\", }\n// after\n{ \"name\": \"myext\" }","handlingStrategy":"validation","validationCode":"Path f = Paths.get(configuredExtensionFile);\nif (!Files.isReadable(f)) throw new IllegalStateException(\"extensionFile unreadable: \" + f);\ntry (InputStream is = Files.newInputStream(f)) {\n  new ObjectMapper().readTree(is); // throws if JSON is malformed\n}","typeGuard":null,"tryCatchPattern":"try {\n  invoker.executeMaven(\"extension-descriptor\");\n} catch (MojoExecutionException e) {\n  if (e.getMessage().startsWith(\"Failed to parse \")) { validateAndRepairJson(); }\n  throw e;\n}","preventionTips":["jq-validate extension.json before running the goal","Use absolute paths for extensionFile or paths relative to the module executing the mojo","Check JSON diffs carefully for trailing commas in hand edits","Pin the descriptor file in version control to avoid drift"],"tags":["maven-plugin","json-parsing","io","configuration"],"backgroundTag":"json-parse-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}