quarkusio/quarkus · error · UncheckedIOException
Failed to read %s
Error message
Failed to read %s
What it means
An UncheckedIOException thrown inside readConfig while reading a META-INF/services configuration service file from the deployment classpath via ClassPathUtils.consumeAsPaths. Files.readAllLines on a resolved service-file path failed with an IOException, so the resource exists on the classpath but cannot be read. The UncheckedIOException propagates and aborts configuration initialization for code generation.
Source
Thrown at core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java:324
sb.append(System.lineSeparator());
for (String s : missingService.getValue()) {
sb.append("- ").append(s);
}
}
log.warn(sb.toString());
final Map<String, List<String>> allConfigServices = new HashMap<>(unavailableConfigServices.size());
final Map<String, byte[]> allowedConfigServices = new HashMap<>(unavailableConfigServices.size());
final Map<String, byte[]> bannedConfigServices = new HashMap<>(unavailableConfigServices.size());
for (Map.Entry<String, List<String>> appModuleServices : unavailableConfigServices.entrySet()) {
final String service = appModuleServices.getKey();
try {
ClassPathUtils.consumeAsPaths(deploymentClassLoader, service, p -> {
try {
allConfigServices.computeIfAbsent(service, k -> new ArrayList<>())
.addAll(Files.readAllLines(p));
} catch (IOException e) {
throw new UncheckedIOException("Failed to read " + p, e);
}
});
} catch (IOException e) {
throw new CodeGenException("Failed to read resources from classpath", e);
}
final List<String> allServices = allConfigServices.getOrDefault(service, new ArrayList<>());
allServices.removeAll(appModuleServices.getValue());
if (allServices.isEmpty()) {
bannedConfigServices.put(service, new byte[0]);
} else {
final StringJoiner joiner = new StringJoiner(System.lineSeparator());
allServices.forEach(joiner::add);
allowedConfigServices.put(service, joiner.toString().getBytes());
}
}
// we don't want to load config services from the current module because they haven't been compiled yet
final QuarkusClassLoader.Builder configClBuilder = QuarkusClassLoader.builder("CodeGenerator Config ClassLoader",View on GitHub (pinned to e1c734241f)
Solutions
- Identify the jar/file in the message, delete it from the local repository (or target/ dir) and rebuild so it is re-downloaded/re-created
- Check file permissions and that the build process can read the file path in the message
- Check disk space and antivirus/locking software that may block jar reads
- Run a clean build to regenerate all build artifacts
Example fix
# before rm ~/.m2/repository/com/example/broken-artifact/1.0/broken-artifact-1.0.jar # corrupt jar mvn quarkus:build # after: Maven re-downloads a good copy mvn clean quarkus:build
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check that all config service files on the classpath are readable
for (URL u : Collections.list(cl.getResources("META-INF/services/io.quarkus.runtime.configuration.ConfigSource"))) {
Path p = Paths.get(u.toURI());
if (!Files.isReadable(p)) throw new IllegalStateException("Unreadable service file: " + p);
} Prevention
- Keep the local repository clean; use -U to refresh suspicious artifacts
- Avoid antivirus tools locking jar files during builds on Windows
- Ensure sufficient disk space on build machines
- Don't mutate jars (deploy/install) while a build is running
When it happens
Trigger: During readConfig, when unavailable config services were detected, each service file listed on the deployment classpath is read with Files.readAllLines(p); an IOException (I/O error, permission problem, broken jar entry) while reading path p produces 'Failed to read <p>'.
Common situations: Corrupted or partially downloaded jar in the local Maven/Gradle cache; file permission issues on the build machine; disk full; antivirus locking jar files on Windows; build running against a jar that was overwritten mid-build.
Related errors
- Failed to read resources from classpath
- Failed to open path tree with root %s
- Failed to load CodeGenProvider class from deployment classlo
- Failed to create output directory for generated sources: %s
- Could not read class path resources having path '${resourceP
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/25c35ae652bbf0fb.
Report an issue: GitHub.