{"record":{"id":"6483f8662971ef94","repo":"aeron-io/aeron","slug":"no-more-input-found-state-state-in-uri","errorCode":null,"errorMessage":"no more input found, state=<state> in <uri>","messagePattern":"no more input found, state=<state> in <uri>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/ChannelUri.java","lineNumber":485,"sourceCode":"\n                default:\n                    throw new IllegalStateException(\"unexpected state=\" + state + \" in \" + uri);\n            }\n        }\n\n        switch (state)\n        {\n            case MEDIA:\n                media = builder.toString();\n                validateMedia(media);\n                break;\n\n            case PARAMS_VALUE:\n                params.put(key, builder.toString());\n                break;\n\n            default:\n                throw new IllegalStateException(\"no more input found, state=\" + state + \" in \" + uri);\n        }\n\n        return new ChannelUri(prefix, media, params);\n    }\n\n    /**\n     * Add a sessionId to a given channel.\n     *\n     * @param channel   to add sessionId to.\n     * @param sessionId to add to channel.\n     * @return new string that represents channel with sessionId added.\n     */\n    public static String addSessionId(final String channel, final int sessionId)\n    {\n        final ChannelUri channelUri = ChannelUri.parse(channel);\n        channelUri.put(CommonContext.SESSION_ID_PARAM_NAME, Integer.toString(sessionId));\n\n        return channelUri.toString();","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/ChannelUri.java#L467-L503","documentation":"After consuming all input, ChannelUri.parse() checks the final state. Only CHANNEL (done) and PARAMS_VALUE (a pending key=value to flush) are acceptable; any other trailing state (e.g. ended mid-key, mid-prefix, or mid-media) throws this IllegalStateException because the URI ended prematurely.","triggerScenarios":"Calling ChannelUri.parse() on truncated URIs, e.g. \"aeron:udp?endpoint\" (ends mid-key), \"aeron:\" or \"aeron:udp\" fragments, or a URI ending with a bare \"|key\".","commonSituations":"Configuration values cut off by env-var truncation or bad templating; URIs split across lines and partially read; protocol/scheme typos leaving the parser mid-state.","solutions":["Print and complete the URI — ensure it has scheme prefix, media, and well-formed params (e.g. \"aeron:udp?endpoint=host:port\")","Check where the URI string comes from (env var, config file) for truncation or newline issues","Catch IllegalStateException around parse() for untrusted input and report a clear invalid-channel error"],"exampleFix":"// before\nString uri = System.getenv(\"AERON_CHANNEL\"); // \"aeron:udp?endpoint\" (truncated)\nChannelUri.parse(uri);\n// after\nString uri = System.getenv(\"AERON_CHANNEL\");\nif (uri == null || !uri.startsWith(\"aeron:\")) throw new IllegalArgumentException(\"bad AERON_CHANNEL: \" + uri);\nChannelUri.parse(\"aeron:udp?endpoint=localhost:40456\");","handlingStrategy":"validation","validationCode":"static boolean looksLikeCompleteChannelUri(String uri) {\n    return uri.startsWith(\"aeron:\") && uri.length() > \"aeron:\".length()\n        && (uri.startsWith(\"aeron:udp\") || uri.startsWith(\"aeron:ipc\"));\n}","typeGuard":"static boolean isCompleteUri(String uri) {\n    try { ChannelUri.parse(uri); return true; } catch (IllegalStateException e) { return false; }\n}","tryCatchPattern":"try {\n    ChannelUri.parse(uri);\n} catch (IllegalStateException e) {\n    throw new IllegalArgumentException(\"Channel URI truncated or incomplete: '\" + uri + \"'\", e);\n}","preventionTips":["Log the raw URI string (with quotes) on failure to spot truncation/whitespace","Check env vars and config files for length limits or newline truncation","Validate channel URIs at config-load time before passing them to Aeron.addPublication/addSubscription"],"tags":["uri-parsing","config","aeron"],"backgroundTag":"invalid-url-format","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}