{"record":{"id":"52026a89a8e82d5c","repo":"quarkusio/quarkus","slug":"class-reading-failed","errorCode":null,"errorMessage":" class reading failed","messagePattern":" class reading failed","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigPropertyBuildItemCandidateUtil.java","lineNumber":36,"sourceCode":"\npublic class ConfigPropertyBuildItemCandidateUtil {\n\n    private static final Logger LOGGER = Logger.getLogger(ConfigPropertyBuildItemCandidateUtil.class);\n\n    /**\n     * This method inspects the {@code configClass} bytecode to identify all fields that have a default value set in the class\n     * constructor. These fields are removed from the {@link ConfigPropertyBuildItemCandidate} list because we don't want to\n     * throw an exception if no config property value was provided for them. There is no bytecode modification performed during\n     * this process.\n     */\n    public static void removePropertiesWithDefaultValue(ClassLoader classLoader, String configClass,\n            List<ConfigPropertyBuildItemCandidate> candidates) {\n        final String resourceName = fromClassNameToResourceName(configClass);\n        try (InputStream is = classLoader.getResourceAsStream(resourceName)) {\n            ClassReader configClassReader = new ClassReader(is);\n            configClassReader.accept(new ConfigClassVisitor(candidates, configClass), 0);\n        } catch (IOException e) {\n            throw new UncheckedIOException(configClass + \" class reading failed\", e);\n        }\n    }\n\n    private static class ConfigClassVisitor extends ClassVisitor {\n\n        private final List<ConfigPropertyBuildItemCandidate> candidates;\n        private final String configClass;\n\n        private ConfigClassVisitor(List<ConfigPropertyBuildItemCandidate> candidates, String configClass) {\n            super(Gizmo.ASM_API_VERSION);\n            this.candidates = candidates;\n            this.configClass = configClass;\n        }\n\n        @Override\n        public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {\n            MethodVisitor superMethodVisitor = super.visitMethod(access, name, descriptor, signature, exceptions);\n            if (name.equals(\"<init>\") && descriptor.equals(\"()V\")) {","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigPropertyBuildItemCandidateUtil.java#L18-L54","documentation":"removePropertiesWithCandidateAnalysis loads a compiled @ConfigurationProperties class as a resource from the application index and parses it with ASM's ClassReader. If the class resource cannot be read (null stream or I/O failure), the IOException is wrapped in an UncheckedIOException with '<class> class reading failed', aborting the build.","triggerScenarios":"The config class name passed to removePropertiesWithDefaultValue cannot be resolved to a class-file resource by the given ClassLoader (getResourceAsStream returns null, making ClassReader throw a null-stream IOException), or the class file is unreadable/corrupt — raised while filtering config property build item candidates.","commonSituations":"The class is generated or transformed so its .class resource isn't on the deployment-time classpath; a stale incremental build where the class file was deleted; packaging that excludes class resources; class-name/package mismatch after refactoring.","solutions":["Run a clean build (./mvnw clean install) to restore the missing or stale class file in the target output.","Verify the @ConfigurationProperties class exists at the FQCN the annotation references and is compiled into the module on the classpath.","Check build/packaging excludes or shade/relocation config that might strip the .class resource.","Inspect the cause chain of the UncheckedIOException for the underlying IOException details."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// build script: clean rebuild on this failure\ntry {\n  ./mvnw install -f extensions/spring-boot-properties/\n} catch (UncheckedIOException e) if (e.message.endsWith(\"class reading failed\")) {\n  ./mvnw clean install  // rebuild to regenerate the missing/corrupt class resource\n}","preventionTips":["Run clean builds after refactoring config class packages/names","Ensure config classes are plain compiled classes on the application classpath","Check packaging/shade excludes that could strip .class resources"],"tags":["quarkus","build-time","io","classloader"],"backgroundTag":"class-resource-not-found","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"}