{"record":{"id":"63342630ab9d2607","repo":"oracle/graal","slug":"graph-was-permanetly-frozen","errorCode":null,"errorMessage":"Graph was permanetly frozen.","messagePattern":"Graph was permanetly frozen\\.","errorType":"exception","errorClass":"GraalError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graph/Graph.java","lineNumber":1541,"sourceCode":"\n    @SuppressWarnings({\"all\", \"try\"})\n    public EconomicMap<Node, Node> addDuplicates(Iterable<? extends Node> newNodes, final Graph oldGraph, int estimatedNodeCount, DuplicationReplacement replacements, boolean applyGVN) {\n        try (DebugCloseable s = DuplicateGraph.start(getDebug())) {\n            return NodeClass.addGraphDuplicate(this, oldGraph, estimatedNodeCount, newNodes, replacements, applyGVN);\n        }\n    }\n\n    public boolean isFrozen() {\n        return freezeState != FreezeState.Unfrozen;\n    }\n\n    public void freeze() {\n        this.freezeState = FreezeState.DeepFreeze;\n    }\n\n    public void temporaryFreeze() {\n        if (this.freezeState == FreezeState.DeepFreeze) {\n            throw new GraalError(\"Graph was permanetly frozen.\");\n        }\n        this.freezeState = FreezeState.TemporaryFreeze;\n    }\n\n    public void unfreeze() {\n        if (this.freezeState == FreezeState.DeepFreeze) {\n            throw new GraalError(\"Graph was permanetly frozen.\");\n        }\n        this.freezeState = FreezeState.Unfrozen;\n    }\n}\n","sourceCodeStart":1523,"sourceCodeEnd":1553,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graph/Graph.java#L1523-L1553","documentation":"A Graal compiler Graph has a freeze lifecycle: Unfrozen -> TemporaryFreeze -> DeepFreeze. freeze() applies DeepFreeze, a permanent state meaning the graph will never be mutated again (e.g. it was installed in a graph cache or handed to an immutable consumer). temporaryFreeze() is a short-lived guard used during iteration/verification, and it refuses to run on a DeepFreeze graph. Hitting this error means code tried to re-enter a temporary-freeze section on a graph that was already permanently frozen.","triggerScenarios":"Calling graph.temporaryFreeze() at any point after graph.freeze() has already been invoked; e.g. a verification or iteration helper that temporary-freezes runs against a graph that a prior phase (such as caching/installing the graph) already deep-froze. Also nested/temporary-freeze helpers invoked on shared cached graphs.","commonSituations":"Custom compilation phases or graph verifiers that run late in the pipeline, after the graph was frozen for caching. Re-running a debug/verify utility over a graph obtained from a cache. New plugin code that assumes graphs are always mutable.","solutions":["Check graph.isFrozen() (or inspect freezeState) before calling temporaryFreeze() and skip the temporary-freeze path for frozen graphs.","Reorder the pipeline so verification/iteration that needs temporaryFreeze() runs before the permanent freeze() call.","If you own the freeze, delay freeze() until after all verification passes have completed.","Clone the graph (graph.copy()) if you must run mutating or freezing operations on an already deep-frozen instance."],"exampleFix":"// before\ngraph.temporaryFreeze(); // throws if DeepFreeze\n\n// after\nif (!graph.isFrozen()) {\n    graph.temporaryFreeze();\n}","handlingStrategy":"validation","validationCode":"if (graph.isFrozen()) { /* graph is at least temporarily frozen; inspect further or skip */ }\n// Graal exposes isFrozen(); to distinguish DeepFreeze you must track who called freeze()\nif (!graph.isFrozen()) {\n    graph.temporaryFreeze();\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat freeze() as irreversible: audit every call site in your pipeline and guarantee no temporaryFreeze()/unfreeze() runs after it.","In shared utilities, guard temporary-freeze sections with isFrozen() checks instead of assuming an unfrozen graph.","Never run verification helpers against cached graphs; clone them first."],"tags":["java","graal","graal-compiler","graph","state-machine","immutability"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}