oracle/graal · error · GraalError

Error loading phase plan from %s

Error message

Error loading phase plan from %s

What it means

PhasePlanSerializer.loadPhasePlan(String, Suites) reads a previously serialized phase plan (used by Graal's phase-plan fuzzing infrastructure) from a file via DataInputStream. Any IOException while opening or reading the file — missing file, wrong format, truncated stream — is wrapped in a GraalError naming the file path.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/phases/fuzzing/PhasePlanSerializer.java:129

    }

    /**
     * Serializes the given {@link Suites} and saves it in the given {@link DataOutputStream}.
     */
    public static void savePhasePlan(DataOutputStream dos, Suites phasePlan) throws IOException {
        savePhaseSuite(phasePlan.getHighTier(), dos, "high tier");
        savePhaseSuite(phasePlan.getMidTier(), dos, "mid tier");
        savePhaseSuite(phasePlan.getLowTier(), dos, "low tier");
    }

    /**
     * Creates {@link Suites} by loading the suites' serialized version contained in the given file.
     */
    public static <C> Suites loadPhasePlan(String fileName, Suites originalSuites) {
        try (DataInputStream in = new DataInputStream(new FileInputStream(fileName))) {
            return loadPhasePlan(in, originalSuites);
        } catch (IOException e) {
            throw new GraalError(e, "Error loading phase plan from %s", fileName);
        }
    }

    /**
     * Creates {@link Suites} by loading the suites' serialized version contained in the given
     * {@link DataInputStream}.
     */
    @SuppressWarnings("unchecked")
    public static <C> Suites loadPhasePlan(DataInputStream in, Suites originalSuites) throws IOException {
        Map<String, BasePhase<? super C>> lookup = new EconomicHashMap<>();
        collect(lookup, ((PhaseSuite<C>) originalSuites.getHighTier()), "high tier");
        collect(lookup, ((PhaseSuite<C>) originalSuites.getMidTier()), "mid tier");
        collect(lookup, ((PhaseSuite<C>) originalSuites.getLowTier()), "low tier");

        PhaseSuite<HighTierContext> highTier = (PhaseSuite<HighTierContext>) loadPhaseSuite(in, lookup);
        PhaseSuite<MidTierContext> midTier = (PhaseSuite<MidTierContext>) loadPhaseSuite(in, lookup);
        PhaseSuite<LowTierContext> lowTier = (PhaseSuite<LowTierContext>) loadPhaseSuite(in, lookup);
        return new Suites(highTier, midTier, lowTier);

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Verify the file exists at the exact path passed in and is readable; check the working directory for relative paths.
  2. Regenerate the phase plan file with the same Graal build that consumes it — the binary format is version-specific.
  3. Inspect the chained IOException (GraalError.getCause()) to distinguish 'file not found' from format corruption (EOFException/UTFDataFormatException).
Defensive patterns

Strategy: try-catch

Validate before calling

Path plan = Path.of(fileName);
if (!Files.isReadable(plan)) {
    throw new FileNotFoundException("Phase plan not readable: " + plan.toAbsolutePath());
}
Suites s = PhasePlanSerializer.loadPhasePlan(fileName, originalSuites);

Try / catch

try {
    Suites suites = PhasePlanSerializer.loadPhasePlan(fileName, original);
} catch (GraalError e) {
    if (e.getCause() instanceof IOException ioe) {
        LOG.error("Cannot load phase plan {}: {}", fileName, ioe);
        return original; // fall back to default suites
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling loadPhasePlan with a path that does not exist, a file written by a different (incompatible) PhasePlanSerializer version, a file truncated mid-write, or lacking read permission. The DataInputStream read* calls throw EOF/UTFDataFormatException variants that all land in this wrapper.

Common situations: Compiler fuzzing workflows (e.g. with the Espresso/Graal fuzzing harness) where phase plans are generated on one machine/commit and consumed on another; stale plan files after a Graal upgrade changed the serialization format; relative paths resolved against an unexpected working directory.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/551fc1f76edb9029. Report an issue: GitHub.