quarkusio/quarkus · error · RuntimeException

Error reading file: ${p}

Error message

Error reading file: ${p}

What it means

In fetchUpdateRecipes(), each matched recipe file's bytes are read with Files.readAllBytes(p); if that read throws IOException it is wrapped in RuntimeException("Error reading file: <path>"). This is a plain filesystem read failure of an already-identified recipe YAML file.

Source

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

                path -> findRecipeDirectories(path, recipeDirectoryNames)
                        .flatMap(d -> {
                            log.info("* matching recipes directory '%s' found:", d.relativeDir);
                            Set<VersionUpdate> versions = d.versions();
                            try (Stream<Path> recipePath = Files.list(path.resolve(d.relativeDir()))) {
                                final List<String> recipes = recipePath
                                        .filter(QuarkusUpdatesRepository::isRecipeFile)
                                        .filter(p -> shouldApplyRecipe(p.getFileName().toString(),
                                                versions))
                                        .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) {
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check and fix read permissions (chmod/chown) on the recipe YAML files and their directories.
  2. Verify the file still exists and is a regular readable file (no dangling symlink).
  3. Re-extract or re-download the update recipes artifact if files are missing or truncated.
  4. Check filesystem health (disk errors, stale NFS mounts) if the recipes live on shared storage.

Example fix

// shell: fix unreadable recipe files
chmod -R u+r ~/.quarkus/update-recipes/
// then rerun
quarkus update --update-versions=3.15
Defensive patterns

Strategy: validation

Validate before calling

if (!Files.isRegularFile(p) || !Files.isReadable(p)) {
    throw new IOException("Recipe file missing or unreadable before update: " + p);
}

Try / catch

try {
    recipes = repo.fetchUpdateRecipes(...);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Error reading file")) {
        log.error("Fix permissions/re-extract recipes: " + e.getMessage(), e);
    }
}

Prevention

When it happens

Trigger: fetchUpdateRecipes (called by newRecipes during `quarkus update`) walks recipe directories, finds a matching recipe file via isRecipeFile, and Files.readAllBytes fails — file deleted between discovery and read, permission denied, or a broken symlink.

Common situations: Permission-restricted recipe files copied from another machine/user; files removed or renamed concurrently by another process; filesystem errors on network-mounted directories; case-sensitivity mismatches leaving dangling symlinks.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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