quarkusio/quarkus · error · RuntimeException

Cannot reset file manager

Error message

Cannot reset file manager

What it means

QuarkusFileManager.reset re-applies the compiler context to the existing file manager, including the ANNOTATION_PROCESSOR_PATH location. An IOException there is wrapped in RuntimeException 'Cannot reset file manager'. This happens on live-reload recompilation when the processor path became invalid between compilations.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java:53

    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());
            }
        } catch (IOException e) {
            throw new RuntimeException("Cannot reset file manager", e);
        }
    }

    private void ensureDirectories(Iterable<File> directories) {
        for (File directory : directories) {
            ensureDirectory(directory);
        }
    }

    private void ensureDirectory(File directory) {
        if (!directory.exists()) {
            if (!directory.mkdirs()) {
                throw new RuntimeException("Cannot create directory " + directory);
            }
        }
    }

    @Override

View on GitHub (pinned to e1c734241f)

Solutions

  1. Stop dev mode, run mvn clean install, and restart dev mode so paths exist before reset.
  2. Ensure annotation-processor paths exist and are writable before triggering recompilation.
  3. Avoid running mvn clean concurrently with quarkus:dev; use dev-mode tooling to clean instead.
  4. Check disk space / AV interference on the build directory.

Example fix

// before: target/ wiped while dev mode live-reloads -> reset throws
// after: ./mvnw quarkus:dev (restart) instead of mvn clean during dev mode
Defensive patterns

Strategy: try-catch

Validate before calling

for (File dir : context.getAnnotationProcessorPaths()) {
    if (!dir.canRead()) throw new IllegalStateException("processor path unreadable before reset: " + dir);
}

Try / catch

try {
    fileManager.reset(context);
} catch (RuntimeException e) {
    if ("Cannot reset file manager".equals(e.getMessage())) {
        Throwable cause = e.getCause();
        log.errorf("Reset failed: %s — recreate processor paths and restart dev mode", cause.getMessage());
        // rebuild project and restart quarkus:dev
    } else throw e;
}

Prevention

When it happens

Trigger: Calling reset(context) where setLocation(ANNOTATION_PROCESSOR_PATH, context.getAnnotationProcessorPaths()) throws IOException — typically a processor-path directory/JAR vanished or became unusable since construction.

Common situations: mvn clean executed while dev mode is running; antivirus or IDE locks making paths unreadable; quarkusio/quarkus#42908 scenario where processor paths are missing; out-of-disk conditions.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/e0e176225804908e. Report an issue: GitHub.