{"record":{"id":"95cfe42f4fafc9dc","repo":"quarkusio/quarkus","slug":"failed-to-load-extension-metadata-schema-from-sch","errorCode":null,"errorMessage":"Failed to load extension metadata schema from <schemaResource>","messagePattern":"Failed to load extension metadata schema from <schemaResource>","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/ExtensionMetadataValidator.java","lineNumber":37,"sourceCode":" * This class is shared by the extension Maven plugin and the extension Gradle plugin so that the\n * validation logic is not duplicated.\n */\npublic final class ExtensionMetadataValidator {\n\n    private ExtensionMetadataValidator() {\n    }\n\n    /**\n     * Validates the given extension descriptor against the bundled JSON schema.\n     *\n     * @param extObject the extension descriptor\n     * @throws IOException if the schema cannot be loaded or the descriptor is invalid\n     */\n    public static void validate(ObjectNode extObject) throws IOException {\n        final Schema schema;\n        try (InputStream is = ExtensionMetadataValidator.class.getResourceAsStream(ToolsConstants.EXTENSION_SCHEMA_RESOURCE)) {\n            if (is == null) {\n                throw new IOException(\n                        \"Failed to load extension metadata schema from \" + ToolsConstants.EXTENSION_SCHEMA_RESOURCE);\n            }\n\n            final SchemaRegistry schemaRegistry = SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_2020_12);\n            schema = schemaRegistry.getSchema(is, InputFormat.JSON);\n            schema.initializeValidators();\n        }\n\n        final List<com.networknt.schema.Error> errors = schema.validate(extObject.toString(), InputFormat.JSON);\n        if (!errors.isEmpty()) {\n            final StringBuilder sb = new StringBuilder();\n            sb.append(\"Invalid \").append(BootstrapConstants.QUARKUS_EXTENSION_FILE_NAME).append(\" metadata:\");\n            for (com.networknt.schema.Error err : errors) {\n                sb.append(System.lineSeparator()).append(\"- \").append(err.getInstanceLocation()).append(\": \")\n                        .append(err.getMessage());\n            }\n            throw new IOException(sb.toString());\n        }","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/ExtensionMetadataValidator.java#L19-L55","documentation":"ExtensionMetadataValidator.validate loads the JSON schema bundled with the tools (ToolsConstants.EXTENSION_SCHEMA_RESOURCE) from the classpath to validate a quarkus-extension.yaml descriptor object. If the schema resource cannot be found on the classpath, it throws IOException with this message.","triggerScenarios":"Calling ExtensionMetadataValidator.validate in an environment where the schema resource is absent — schema file removed from the jar, shaded/fat jar excluding it, or a broken dependency (wrong devtools-common version) on the classpath.","commonSituations":"Custom builds with resource filtering excluding .json schema files; running tools from an incomplete classpath; classloader issues in isolated environments (e.g. Maven plugin realms) hiding the resource.","solutions":["Verify quarkus-devtools-common on the classpath contains the schema resource (open the jar and check for the resource under ToolsConstants.EXTENSION_SCHEMA_RESOURCE)","Rebuild/reinstall the quarkus-devtools-common module so the schema is packaged","Check for resource-exclusion filters (maven-shade/maven-jar resource includes) and add the schema resource"],"exampleFix":"// pom.xml shade config\n// before\n<exclude>**/*.json</exclude>\n// after\n<exclude>**/*.json</exclude>\n<exclude>schema/extension-metadata.json</exclude> <!-- keep it, or remove this pattern -->\n(adjust: do NOT exclude ToolsConstants.EXTENSION_SCHEMA_RESOURCE)","handlingStrategy":"validation","validationCode":"String res = ToolsConstants.EXTENSION_SCHEMA_RESOURCE;\nif (ExtensionMetadataValidator.class.getResourceAsStream(res) == null) {\n    throw new IllegalStateException(\"Schema resource missing from classpath: \" + res);\n}\nExtensionMetadataValidator.validate(extObject);","typeGuard":null,"tryCatchPattern":"try {\n    ExtensionMetadataValidator.validate(extObject);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Failed to load extension metadata schema\")) {\n        throw new IllegalStateException(\"quarkus-devtools-common jar is incomplete or mis-shaded\", e);\n    }\n    throw e;\n}","preventionTips":["Do not exclude *.json resources in shade/jar plugin filters","Use an official quarkus-devtools-common release artifact, not a locally trimmed jar","Verify jar contents after any custom packaging step"],"tags":["classpath","schema","missing-resource"],"backgroundTag":"missing-classpath-resource","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}