{"record":{"id":"af635e6df79bca1a","repo":"quarkusio/quarkus","slug":"unable-to-read-the-template-template","errorCode":null,"errorMessage":"Unable to read the template: ${template}","messagePattern":"Unable to read the template: (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateConfigDocMojo.java","lineNumber":493,"sourceCode":"        }\n\n        InputStream is = null;\n        ;\n        for (String candidate : candidates) {\n            is = Thread.currentThread().getContextClassLoader().getResourceAsStream(candidate);\n            if (is != null) {\n                break;\n            }\n        }\n\n        if (is == null) {\n            throw new IllegalArgumentException(\"Unable to find a template for these candidates \" + candidates);\n        }\n\n        try {\n            return new String(is.readAllBytes(), StandardCharsets.UTF_8);\n        } catch (IOException e) {\n            throw new UncheckedIOException(\"Unable to read the template: \" + template, e);\n        } finally {\n            try {\n                is.close();\n            } catch (IOException e) {\n                throw new UncheckedIOException(\"Unable to close InputStream for template: \" + template, e);\n            }\n        }\n    }\n\n    private static Set<String> collectDuplicatePropertyPaths(MergedModel mergedModel) {\n        Set<String> seenBuildTime = new HashSet<>();\n        Set<String> seenRunTime = new HashSet<>();\n\n        for (Map<ConfigRootKey, ConfigRoot> configRoots : mergedModel.getConfigRoots().values()) {\n            for (ConfigRoot configRoot : configRoots.values()) {\n                collectPropertyPhases(configRoot, seenBuildTime, seenRunTime);\n            }\n        }","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateConfigDocMojo.java#L475-L511","documentation":"After locating the template resource, getTemplate reads its bytes as UTF-8; an IOException during reading is wrapped in UncheckedIOException 'Unable to read the template: <template>'. The resource exists but its content could not be read.","triggerScenarios":"The InputStream for the resolved template fails mid-read: the jar/resource is corrupted, truncated on disk, or the underlying stream errors.","commonSituations":"Corrupted local Maven repository cache (~/.m2) after an interrupted download; damaged plugin jar in a shaded/uber jar build.","solutions":["Delete the plugin artifact from the local Maven repository and re-download (mvn -U)","Reinstall the plugin locally with mvn install if built from source","Verify the jar integrity and rebuild if it is a local uber-jar"],"exampleFix":"// before\n~/.m2/repository/io/quarkus/quarkus-config-doc-maven-plugin/  <!-- corrupted -->\n// after\nrm -rf ~/.m2/repository/io/quarkus/quarkus-config-doc-maven-plugin/ && mvn -U ...","handlingStrategy":"retry","validationCode":"// Check jar integrity before build\nFiles.size(Paths.get(pluginJarPath)); // and compare checksum if published","typeGuard":null,"tryCatchPattern":"try {\n    mojo.execute();\n} catch (UncheckedIOException e) {\n    if (e.getMessage().startsWith(\"Unable to read the template\")) {\n        // purge artifact from ~/.m2 and retry with -U\n    }\n}","preventionTips":["Use mvn -U after interrupted downloads","Avoid repackaging the plugin into uber-jars unfiltered","Monitor disk health on CI runners"],"tags":["io","maven","template"],"backgroundTag":"resource-read-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"}