quarkusio/quarkus · error · UncheckedIOException

An error occurred while processing ${resourcePath}

Error message

An error occurred while processing ${resourcePath}

What it means

When collecting OpenAPI model resources, the processor first tries to list files in the target classes directory for the resource path. If Files.list on that directory throws IOException, it throws an UncheckedIOException with this message, failing the build.

Source

Thrown at extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java:1328

            if (matcher.matches()) {
                return true;
            }
        }
        return false;
    }

    private List<String> getResourceFiles(Path resourcePath, Path target) {
        final String resourceName = ClassPathUtils.toResourceName(resourcePath);
        List<String> filenames = new ArrayList<>();
        // Here we are resolving the resource dir relative to the classes dir and if it does not exist, we fall back to locating the resource dir on the classpath.
        // Although the classes dir should already be on the classpath.
        // In a QuarkusExtensionTest the module's classes dir and the test application root could be different directories, is this code here for that reason?
        final Path targetResourceDir = target == null ? null : target.resolve("classes").resolve(resourcePath);
        if (targetResourceDir != null && Files.exists(targetResourceDir)) {
            try (Stream<Path> paths = Files.list(targetResourceDir)) {
                return paths.map(t -> resourceName + "/" + t.getFileName().toString()).toList();
            } catch (IOException e) {
                throw new UncheckedIOException("An error occurred while processing " + resourcePath, e);
            }
        } else {
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            // QuarkusClassLoader will return a ByteArrayInputStream of directory entry names
            try (InputStream inputStream = cl.getResourceAsStream(resourceName)) {
                if (inputStream != null) {
                    try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
                        String resource;
                        while ((resource = br.readLine()) != null) {
                            filenames.add(resourceName + "/" + resource);
                        }
                    }
                }
            } catch (IOException e) {
                throw new UncheckedIOException("An error occurred while processing " + resourcePath, e);
            }
        }
        return filenames;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix read permissions on the target/ directory, or run ./mvnw clean to regenerate it
  2. Close tools that may lock build output (antivirus, file sync services, open editors/terminals in target/)
  3. Rebuild from a clean checkout if target/ is corrupted

Example fix

# before (unreadable target dir)
chmod -R u+rw target/
./mvnw clean package
Defensive patterns

Strategy: try-catch

Validate before calling

Path dir = target.resolve("classes").resolve(resourcePath);
if (!Files.isDirectory(dir) || !Files.isReadable(dir)) { /* fall back to classpath listing */ }

Try / catch

try { ...build... } catch (UncheckedIOException e) { if (e.getMessage().contains("error occurred while processing")) { fix permissions / clean target and rebuild; } throw e; }

Prevention

When it happens

Trigger: IOException while listing the directory target/<resourcePath> under the build output — e.g. permission denied, the path exists but is a file, or an I/O error on the filesystem.

Common situations: Build output owned by another user/CI artifact with wrong permissions; antivirus or sync tools (Dropbox/OneDrive) locking build dirs; target directory partially deleted during the build.

Related errors


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