oracle/graal · error · RuntimeException

unknown verbosity:

Error message

unknown verbosity: 

What it means

Node.toString(Verbosity) renders a node with a switch over the Verbosity enum (Name, Id, Properties, All, ...). The default branch throws RuntimeException when the switch falls through, which happens when toString is called with a Verbosity constant the switch does not handle, or with null. It is a defensive exhaustiveness check: adding a Verbosity constant without extending the switch (or passing an unexpected value) trips it.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graph/Node.java:1855

            case Long:
                return toString(Verbosity.Short);
            case AllVerbose:
            case All: {
                StringBuilder str = new StringBuilder();
                str.append(toString(Verbosity.Short)).append(" { ");
                for (Map.Entry<Object, Object> entry : getDebugProperties().entrySet()) {
                    if (verbosity == Verbosity.All) {
                        if (entry.getKey().equals(NODE_INSERTION_POSITION_NAME) || entry.getKey().equals(NODE_SOURCE_POSITION_NAME)) {
                            continue;
                        }
                    }
                    str.append(entry.getKey()).append("=").append(entry.getValue()).append(", ");
                }
                str.append(" }");
                return str.toString();
            }
            default:
                throw new RuntimeException("unknown verbosity: " + verbosity);
        }
    }

    /**
     * Note that this is not a stable identity. It's updated when a node is
     * {@linkplain #markDeleted() deleted} or potentially when its graph is
     * {@linkplain StructuredGraph#maybeCompress compressed}.
     *
     * @see NodeIdAccessor
     */
    @Deprecated
    public int getId() {
        return id;
    }

    @Deprecated
    public int getIdBeforeDeletion() {
        assert isDeleted();

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Use one of the standard constants the switch handles: Verbosity.Name, Verbosity.Id, Verbosity.Properties, or Verbosity.All.
  2. Null-check verbosity before calling toString(Verbosity) and default to Verbosity.Name.
  3. If you added a Verbosity constant, add a matching case to the switch in Node.toString(Verbosity).

Example fix

// before
String s = node.toString(verbosity); // throws for unhandled constant

// after
String s = node.toString(verbosity != null ? verbosity : Verbosity.Name);
Defensive patterns

Strategy: validation

Validate before calling

static Verbosity safe(Verbosity v) {
    return (v == Verbosity.Name || v == Verbosity.Id || v == Verbosity.Properties || v == Verbosity.All) ? v : Verbosity.Name;
}
String s = node.toString(safe(verbosity));

Type guard

private static boolean isSupportedVerbosity(Verbosity v) {
    return v == Verbosity.Name || v == Verbosity.Id || v == Verbosity.Properties || v == Verbosity.All;
}

Prevention

When it happens

Trigger: Calling node.toString(Verbosity) with a value outside the handled set (e.g. a newly added enum constant like Verbosity.Stack or a null reference). Extending the Verbosity enum in a fork of the compiler and printing nodes with the new constant. Debug printers that forward a user-supplied verbosity straight into this method.

Common situations: Custom debug/logging code that formats nodes with a chosen verbosity. Forks or newer Graal versions that added Verbosity constants while this switch was not updated. Passing null verbosity due to an unset option.

Related errors


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