{"record":{"id":"ef115581e80728ba","repo":"quarkusio/quarkus","slug":"extra-characters-after-quoted-string","errorCode":null,"errorMessage":"Extra characters after quoted string:","messagePattern":"Extra characters after quoted string:","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/request/AcceptHeaders.java","lineNumber":190,"sourceCode":"            offset = equalsIndex + 1;\n            if (header.charAt(offset) == '\"') {\n                int end = offset;\n                ++offset;\n                do {\n                    end = header.indexOf('\"', ++end);\n                    if (end < 0)\n                        throw new BadRequestException(\"Unclosed quotes:\" + header);\n                } while (header.charAt(end - 1) == '\\\\');\n                String value = header.substring(offset, end);\n                parameters.put(name, value);\n                offset = end + 1;\n\n                int parameterEndIndex = header.indexOf(';', offset);\n                int itemEndIndex = header.indexOf(',', offset);\n                if (parameterEndIndex == itemEndIndex) {\n                    assert itemEndIndex == -1;\n                    if (header.substring(offset).trim().length() != 0)\n                        throw new BadRequestException(\"Extra characters after quoted string:\" + header);\n                    return -1;\n                } else if (parameterEndIndex < 0 || (itemEndIndex >= 0 && itemEndIndex < parameterEndIndex)) {\n                    if (header.substring(offset, itemEndIndex).trim().length() != 0)\n                        throw new BadRequestException(\"Extra characters after quoted string:\" + header);\n                    return itemEndIndex + 1;\n                } else {\n                    if (header.substring(offset, parameterEndIndex).trim().length() != 0)\n                        throw new BadRequestException(\"Extra characters after quoted string:\" + header);\n                    offset = parameterEndIndex + 1;\n                }\n            } else {\n                int parameterEndIndex = header.indexOf(';', offset);\n                int itemEndIndex = header.indexOf(',', offset);\n                if (parameterEndIndex == itemEndIndex) {\n                    assert itemEndIndex == -1;\n                    String value = header.substring(offset).trim();\n                    parameters.put(name, value);\n                    return -1;","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/request/AcceptHeaders.java#L172-L208","documentation":"After a quoted parameter value ends, parseParameters() checks the remaining text up to the end of the header. If non-whitespace characters remain after the closing quote, this BadRequestException is thrown.","triggerScenarios":"Header like 'application/json;x=\"v\"junk' — characters after the quoted value that are neither ';' nor a valid terminator.","commonSituations":"Typos in hand-written headers; string-building bugs appending text after quoted values; proxies rewriting quoted parameter values.","solutions":["Remove stray characters between the closing quote and the next ';' or ',' or end of header","Fix header-building code so quoted values are followed by a delimiter","Verify no proxy or interceptor mangles the header"],"exampleFix":"// before\nAccept: application/json;x=\"v\"junk\n// after\nAccept: application/json;x=\"v\"","handlingStrategy":"validation","validationCode":"java.util.regex.Pattern QUOTED_PARAM = java.util.regex.Pattern.compile(\"\\\\w+=\\\"[^\\\"]*\\\"\");\nboolean noTrailingJunk(String header) {\n    return header == null || QUOTED_PARAM.split(header, 2).length < 2;\n}","typeGuard":null,"tryCatchPattern":"try {\n    types = AcceptHeaders.getMediaTypeQualityValues(accept);\n} catch (BadRequestException e) {\n    types = Collections.emptyMap();\n}","preventionTips":["Follow every quoted value with only ';' or ',' or end-of-header","Build headers from structured parameter maps, not string concatenation","Add integration tests asserting exact header strings sent to the server"],"tags":["http","header-parsing","quoting"],"backgroundTag":"malformed-http-header","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}