aeron-io/aeron · error · IllegalStateException

unexpected state= in

Error message

unexpected state=<state> in <uri>

What it means

ChannelUri.parse()'s state machine hits a state not covered by its switch — a defensive default that should be unreachable for any input, indicating an internal parsing invariant was violated. It throws IllegalStateException including the current state and URI.

Solutions

  1. Report it as a library bug with the URI and state value from the message
  2. Verify you are running unmodified, consistent versions of the Aeron client jars (no shaded/mixed versions)
  3. If you patched the parser, add the missing case for the new State
Defensive patterns

Strategy: try-catch

Try / catch

try {
    ChannelUri.parse(uri);
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("unexpected state=")) {
        throw new AssertionError("Aeron parser bug, report with URI: " + uri, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: In practice unreachable from public parse() input alone; would occur only if the parser code is modified (new State enum value added without a case) or via a corrupted build.

Common situations: Custom forks/patches of ChannelUri that add states; unexpected library/version mismatch where a modified parser sees an unknown state value.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12). Data as JSON: /api/errors/20aea16cc50968ab. Report an issue: GitHub.

Appendix: source

Thrown at aeron-client/src/main/java/io/aeron/ChannelUri.java:469

                        builder.append(c);
                    }
                    break;

                case PARAMS_VALUE:
                    if (c == '|')
                    {
                        params.put(key, builder.toString());
                        builder.setLength(0);
                        state = State.PARAMS_KEY;
                    }
                    else
                    {
                        builder.append(c);
                    }
                    break;

                default:
                    throw new IllegalStateException("unexpected state=" + state + " in " + uri);
            }
        }

        switch (state)
        {
            case MEDIA:
                media = builder.toString();
                validateMedia(media);
                break;

            case PARAMS_VALUE:
                params.put(key, builder.toString());
                break;

            default:
                throw new IllegalStateException("no more input found, state=" + state + " in " + uri);
        }

View on GitHub (pinned to 6d60124e15)