{"record":{"id":"d16f8d764837b9b3","repo":"quarkusio/quarkus","slug":"failed-to-read-resources-from-classpath","errorCode":null,"errorMessage":"Failed to read resources from classpath","messagePattern":"Failed to read resources from classpath","errorType":"exception","errorClass":"CodeGenException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java","lineNumber":328,"sourceCode":"            }\n            log.warn(sb.toString());\n\n            final Map<String, List<String>> allConfigServices = new HashMap<>(unavailableConfigServices.size());\n            final Map<String, byte[]> allowedConfigServices = new HashMap<>(unavailableConfigServices.size());\n            final Map<String, byte[]> bannedConfigServices = new HashMap<>(unavailableConfigServices.size());\n            for (Map.Entry<String, List<String>> appModuleServices : unavailableConfigServices.entrySet()) {\n                final String service = appModuleServices.getKey();\n                try {\n                    ClassPathUtils.consumeAsPaths(deploymentClassLoader, service, p -> {\n                        try {\n                            allConfigServices.computeIfAbsent(service, k -> new ArrayList<>())\n                                    .addAll(Files.readAllLines(p));\n                        } catch (IOException e) {\n                            throw new UncheckedIOException(\"Failed to read \" + p, e);\n                        }\n                    });\n                } catch (IOException e) {\n                    throw new CodeGenException(\"Failed to read resources from classpath\", e);\n                }\n                final List<String> allServices = allConfigServices.getOrDefault(service, new ArrayList<>());\n                allServices.removeAll(appModuleServices.getValue());\n                if (allServices.isEmpty()) {\n                    bannedConfigServices.put(service, new byte[0]);\n                } else {\n                    final StringJoiner joiner = new StringJoiner(System.lineSeparator());\n                    allServices.forEach(joiner::add);\n                    allowedConfigServices.put(service, joiner.toString().getBytes());\n                }\n            }\n\n            // we don't want to load config services from the current module because they haven't been compiled yet\n            final QuarkusClassLoader.Builder configClBuilder = QuarkusClassLoader.builder(\"CodeGenerator Config ClassLoader\",\n                    deploymentClassLoader, false);\n            if (!allowedConfigServices.isEmpty()) {\n                configClBuilder.addNormalPriorityElement(new MemoryClassPathElement(allowedConfigServices, true));\n            }","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java#L310-L346","documentation":"CodeGenException thrown by readConfig when consuming META-INF/services configuration service paths from the deployment classpath fails at the ClassPathUtils.consumeAsPaths level with an IOException. Unlike error 22 (a single file read failing), this means enumerating/opening the classpath resource itself failed, aborting configuration initialization for code generation.","triggerScenarios":"readConfig calls ClassPathUtils.consumeAsPaths(deploymentClassLoader, service, ...) to enumerate all copies of a config service file across classpath roots; any IOException thrown while walking those roots is caught and rethrown as 'Failed to read resources from classpath'.","commonSituations":"Corrupted jars on the build classpath; filesystem errors (permissions, disk full) while scanning the classpath; a jar changed or removed while the build was in progress (parallel build, IDE sync during build).","solutions":["Find and repair the offending classpath entry (usually a corrupt jar) — delete it from the local repository and rebuild","Run a clean build so all classpath artifacts are regenerated","Avoid concurrent builds/IDE syncs that mutate jars while Quarkus reads them","Check filesystem health: permissions, disk space, symlink validity"],"exampleFix":"# before: jar being mutated during build (parallel builds)\nmvn quarkus:build &\n./build.sh  # overwrites jars concurrently\n// after: run builds sequentially\nmvn clean quarkus:build","handlingStrategy":"validation","validationCode":"// Verify classpath jars are readable before invoking the build\nfor (Path jar : classpathJars) {\n    if (!Files.isReadable(jar)) throw new IllegalStateException(\"Cannot read: \" + jar);\n    try (var fs = FileSystems.newFileSystem(jar, (ClassLoader) null)) { /* open ok */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run clean builds when classpath artifacts were modified externally","Avoid concurrent builds sharing the same local repository/working directory","Verify jar integrity after network hiccups (re-download with mvn -U)","Monitor disk health and space on CI agents"],"tags":["quarkus","io","classpath","service-files"],"backgroundTag":"unreadable-classpath-resource","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"}