quarkusio/quarkus · error · RuntimeException

Error listing files in directory: ${relativeDir}

Error message

Error listing files in directory: ${relativeDir}

What it means

fetchUpdateRecipes() lists files in each recipe directory and streams the matching ones; if the directory listing throws IOException it is wrapped in RuntimeException("Error listing files in directory: <relativeDir>"). The failure happens before any file content is read — the directory itself could not be enumerated.

Source

Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdatesRepository.java:215

                                        .sorted(RecipeVersionComparator.INSTANCE)
                                        .map(p -> {
                                            try {
                                                log.info("    - '%s' (%s)",
                                                        p.getFileName().toString(),
                                                        versions.stream().map(v -> v.from() + " -> " + v.to())
                                                                .collect(Collectors.joining(", ")));
                                                return new String(Files.readAllBytes(p));
                                            } catch (IOException e) {
                                                throw new RuntimeException("Error reading file: " + p,
                                                        e);
                                            }
                                        }).toList();
                                if (recipes.isEmpty()) {
                                    log.info("\t\t- no matching recipes.");
                                }
                                return recipes.stream();
                            } catch (IOException e) {
                                throw new RuntimeException("Error listing files in directory: " + d.relativeDir(), e);
                            }
                        }).toList());
    }

    record RecipeDirectory(String relativeDir, Set<VersionUpdate> versions) {
    }

    record VersionUpdate(String from, String to) {
    }

    private static Stream<RecipeDirectory> findRecipeDirectories(Path rootDir,
            Map<String, VersionUpdate> recipeDirectoryNames) {
        return findDirsWithRecipes(rootDir).stream()
                .map(d -> {
                    String relativeDir = rootDir.relativize(d).toString();
                    return resolveVersionsForRecipesDir(relativeDir, toKey(relativeDir), recipeDirectoryNames);
                })
                .filter(Optional::isPresent)

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure all recipe directories exist by re-extracting/re-downloading the update recipes.
  2. Fix directory read/execute permissions (chmod +rx).
  3. Check the mount/filesystem health if recipes are on network storage.
  4. Rerun `quarkus update` without concurrent processes modifying the recipes directory.

Example fix

// shell: restore a missing recipe directory
unzip -o ~/.m2/repository/io/quarkus/quarkus-update-recipes/3.15.0/*.jar -d ~/.quarkus/update-recipes/
// then rerun
quarkus update
Defensive patterns

Strategy: validation

Validate before calling

if (!Files.isDirectory(dir) || !Files.isReadable(dir)) {
    throw new IOException("Recipe directory missing or unreadable before update: " + dir);
}

Try / catch

try {
    recipes = repo.fetchUpdateRecipes(...);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Error listing files")) {
        log.error("Restore directory/permissions for: " + e.getMessage(), e);
    }
}

Prevention

When it happens

Trigger: fetchUpdateRecipes (called by newRecipes) iterates RecipeDirectory entries and calls a directory-walk/list operation that throws IOException for that directory — directory missing, permission denied on the directory, or I/O error on the filesystem.

Common situations: Recipes directory partially extracted so some subdirectories are absent; restrictive permissions on a subdirectory; stale NFS/network mount; directory removed by a cleanup job while `quarkus update` runs.

Related errors


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