{"record":{"id":"d9bf1d23a08e05d6","repo":"quarkusio/quarkus","slug":"unable-to-close-inputstream-for-template-templa","errorCode":null,"errorMessage":"Unable to close InputStream for template: ${template}","messagePattern":"Unable to close InputStream for 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":498,"sourceCode":"            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        }\n        for (ConfigRoot configRoot : mergedModel.getConfigRootsInSpecificFile().values()) {\n            collectPropertyPhases(configRoot, seenBuildTime, seenRunTime);\n        }\n        for (List<ConfigSection> sections : mergedModel.getGeneratedConfigSections().values()) {\n            for (ConfigSection section : sections) {","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateConfigDocMojo.java#L480-L516","documentation":"In getTemplate's finally block, closing the template InputStream throws, and the close failure is wrapped in UncheckedIOException 'Unable to close InputStream for template: <template>'. Rare; it replaces any pending success with a close-time error.","triggerScenarios":"is.close() throws IOException — typically when reading from a broken jar file system, an interrupted stream, or low-level I/O failure during close.","commonSituations":"Underlying jar/zip handle in a bad state; filesystem errors in containers with I/O pressure; classpath resource served over a flaky custom URL handler.","solutions":["Check the source jar/filesystem for corruption and rebuild or re-download it","Retry the build; transient I/O close failures often disappear on rerun","If a custom locator supplies the stream, ensure close() is safe and idempotent"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    mojo.execute();\n} catch (UncheckedIOException e) {\n    if (e.getMessage().startsWith(\"Unable to close InputStream\")) {\n        // transient I/O — log and retry the build once\n    }\n}","preventionTips":["Retry the build once on close failures","Check container/host I/O health","Fix custom template locators to return safely closable streams"],"tags":["io","maven","resource-cleanup"],"backgroundTag":"resource-close-failed","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"}