quarkusio/quarkus · error · RuntimeException
Cannot initialize file manager
Error message
Cannot initialize file manager
What it means
QuarkusFileManager's constructor configures the underlying JavaCompiler file manager, including setting the ANNOTATION_PROCESSOR_PATH location. An IOException there means the compiler file manager refused the location setup; it is wrapped in a RuntimeException 'Cannot initialize file manager'. Compilation cannot proceed without a working file manager.
Source
Thrown at core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java:32
public abstract class QuarkusFileManager extends ForwardingJavaFileManager<StandardJavaFileManager> {
protected QuarkusFileManager(StandardJavaFileManager fileManager, Context context) {
super(fileManager);
try {
this.fileManager.setLocation(StandardLocation.CLASS_PATH, context.getClassPath());
this.fileManager.setLocation(StandardLocation.CLASS_OUTPUT, List.of(context.getOutputDirectory()));
if (context.getGeneratedSourcesDirectory() != null) {
// Paths might be missing! (see: https://github.com/quarkusio/quarkus/issues/51178)
ensureDirectory(context.getGeneratedSourcesDirectory());
this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, List.of(context.getGeneratedSourcesDirectory()));
}
if (context.getAnnotationProcessorPaths() != null) {
// Paths might be missing! (see: https://github.com/quarkusio/quarkus/issues/42908)
ensureDirectories(context.getAnnotationProcessorPaths());
this.fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, context.getAnnotationProcessorPaths());
}
} catch (IOException e) {
throw new RuntimeException("Cannot initialize file manager", e);
}
}
public abstract Iterable<? extends JavaFileObject> getJavaSources(Iterable<? extends File> files);
public void reset(Context context) {
try {
this.fileManager.setLocation(StandardLocation.CLASS_PATH, context.getClassPath());
this.fileManager.setLocation(StandardLocation.CLASS_OUTPUT, List.of(context.getOutputDirectory()));
if (context.getGeneratedSourcesDirectory() != null) {
// Paths might be missing! (see: https://github.com/quarkusio/quarkus/issues/51178)
ensureDirectory(context.getGeneratedSourcesDirectory());
this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, List.of(context.getGeneratedSourcesDirectory()));
}
if (context.getAnnotationProcessorPaths() != null) {
// Paths might be missing! (see: https://github.com/quarkusio/quarkus/issues/42908)
ensureDirectories(context.getAnnotationProcessorPaths());
this.fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, context.getAnnotationProcessorPaths());View on GitHub (pinned to e1c734241f)
Solutions
- Run mvn clean install (or ./mvnw compile) to recreate missing processor path directories, then restart dev mode.
- Ensure all paths passed as annotationProcessorPaths exist and are writable.
- Check disk space and permissions on the build directories.
- Restart dev mode after a clean so the file manager is constructed with valid paths.
Example fix
// before: processor path dir deleted under running dev mode // after (shell): mvn clean && ./mvnw quarkus:dev
Defensive patterns
Strategy: validation
Validate before calling
for (File dir : context.getAnnotationProcessorPaths()) {
if (!dir.exists() && !dir.mkdirs())
throw new IllegalStateException("processor path missing and cannot be created: " + dir);
if (!dir.canRead()) throw new IllegalStateException("processor path unreadable: " + dir);
} Try / catch
try {
new QuarkusFileManagerImpl(...);
} catch (RuntimeException e) {
if ("Cannot initialize file manager".equals(e.getMessage())) {
Throwable cause = e.getCause();
log.errorf("File manager init failed: %s — rebuild to restore processor paths", cause.getMessage());
// rebuild then retry construction
} else throw e;
} Prevention
- Run a full build before starting dev mode so processor paths exist
- Avoid cleaning build dirs while dev mode runs
- Ensure write access to target directories and free disk space
When it happens
Trigger: Constructing a QuarkusFileManager subclass where fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, paths) throws IOException — e.g. one of the annotation-processor path entries does not exist or is invalid, and ensureDirectories could not create it.
Common situations: Missing annotation-processor path entries after a partial clean (quarkusio/quarkus#42908); corrupted target/classes or processor JAR paths deleted while dev mode runs; disk errors preventing directory creation.
Related errors
- Cannot reset file manager
- Failed to create compiler
- Failed to open class path file <file>
- Cannot create directory ${directory}
- Cannot initialize reloadable file manager
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/dfce76a0a072b978.
Report an issue: GitHub.