{"record":{"id":"551fc1f76edb9029","repo":"oracle/graal","slug":"error-loading-phase-plan-from-s","errorCode":null,"errorMessage":"Error loading phase plan from %s","messagePattern":"Error loading phase plan from (.+?)","errorType":"exception","errorClass":"GraalError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/phases/fuzzing/PhasePlanSerializer.java","lineNumber":129,"sourceCode":"    }\n\n    /**\n     * Serializes the given {@link Suites} and saves it in the given {@link DataOutputStream}.\n     */\n    public static void savePhasePlan(DataOutputStream dos, Suites phasePlan) throws IOException {\n        savePhaseSuite(phasePlan.getHighTier(), dos, \"high tier\");\n        savePhaseSuite(phasePlan.getMidTier(), dos, \"mid tier\");\n        savePhaseSuite(phasePlan.getLowTier(), dos, \"low tier\");\n    }\n\n    /**\n     * Creates {@link Suites} by loading the suites' serialized version contained in the given file.\n     */\n    public static <C> Suites loadPhasePlan(String fileName, Suites originalSuites) {\n        try (DataInputStream in = new DataInputStream(new FileInputStream(fileName))) {\n            return loadPhasePlan(in, originalSuites);\n        } catch (IOException e) {\n            throw new GraalError(e, \"Error loading phase plan from %s\", fileName);\n        }\n    }\n\n    /**\n     * Creates {@link Suites} by loading the suites' serialized version contained in the given\n     * {@link DataInputStream}.\n     */\n    @SuppressWarnings(\"unchecked\")\n    public static <C> Suites loadPhasePlan(DataInputStream in, Suites originalSuites) throws IOException {\n        Map<String, BasePhase<? super C>> lookup = new EconomicHashMap<>();\n        collect(lookup, ((PhaseSuite<C>) originalSuites.getHighTier()), \"high tier\");\n        collect(lookup, ((PhaseSuite<C>) originalSuites.getMidTier()), \"mid tier\");\n        collect(lookup, ((PhaseSuite<C>) originalSuites.getLowTier()), \"low tier\");\n\n        PhaseSuite<HighTierContext> highTier = (PhaseSuite<HighTierContext>) loadPhaseSuite(in, lookup);\n        PhaseSuite<MidTierContext> midTier = (PhaseSuite<MidTierContext>) loadPhaseSuite(in, lookup);\n        PhaseSuite<LowTierContext> lowTier = (PhaseSuite<LowTierContext>) loadPhaseSuite(in, lookup);\n        return new Suites(highTier, midTier, lowTier);","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/phases/fuzzing/PhasePlanSerializer.java#L111-L147","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the file exists at the exact path passed in and is readable; check the working directory for relative paths.","Regenerate the phase plan file with the same Graal build that consumes it — the binary format is version-specific.","Inspect the chained IOException (GraalError.getCause()) to distinguish 'file not found' from format corruption (EOFException/UTFDataFormatException)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"Path plan = Path.of(fileName);\nif (!Files.isReadable(plan)) {\n    throw new FileNotFoundException(\"Phase plan not readable: \" + plan.toAbsolutePath());\n}\nSuites s = PhasePlanSerializer.loadPhasePlan(fileName, originalSuites);","typeGuard":null,"tryCatchPattern":"try {\n    Suites suites = PhasePlanSerializer.loadPhasePlan(fileName, original);\n} catch (GraalError e) {\n    if (e.getCause() instanceof IOException ioe) {\n        LOG.error(\"Cannot load phase plan {}: {}\", fileName, ioe);\n        return original; // fall back to default suites\n    }\n    throw e;\n}","preventionTips":["Write and read phase plans with the same Graal build — treat the format as build-specific.","Regenerate plan files as part of the build rather than committing them across versions."],"tags":["fuzzing","phase-plan","serialization","io","graal-error"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}