{"record":{"id":"9cc7e868427beed9","repo":"apache/flink","slug":"could-not-split-string-illegal-quoting-at-positio","errorCode":null,"errorMessage":"Could not split string. Illegal quoting at position: {}","messagePattern":"Could not split string\\. Illegal quoting at position: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/configuration/StructuredOptionsSplitter.java","lineNumber":100,"sourceCode":"\n        if (escape) {\n            return \"'\" + string.replaceAll(\"'\", \"''\") + \"'\";\n        }\n\n        return string;\n    }\n\n    private static List<String> processTokens(List<Token> tokens) {\n        final List<String> splits = new ArrayList<>();\n        for (int i = 0; i < tokens.size(); i++) {\n            Token token = tokens.get(i);\n            switch (token.getTokenType()) {\n                case DOUBLE_QUOTED:\n                case SINGLE_QUOTED:\n                    if (i + 1 < tokens.size()\n                            && tokens.get(i + 1).getTokenType() != TokenType.DELIMITER) {\n                        int illegalPosition = tokens.get(i + 1).getPosition() - 1;\n                        throw new IllegalArgumentException(\n                                \"Could not split string. Illegal quoting at position: \"\n                                        + illegalPosition);\n                    }\n                    splits.add(token.getString());\n                    break;\n                case UNQUOTED:\n                    splits.add(token.getString());\n                    break;\n                case DELIMITER:\n                    if (i + 1 < tokens.size()\n                            && tokens.get(i + 1).getTokenType() == TokenType.DELIMITER) {\n                        splits.add(\"\");\n                    }\n                    break;\n            }\n        }\n\n        return splits;","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/configuration/StructuredOptionsSplitter.java#L82-L118","documentation":"Thrown by StructuredOptionsSplitter.processTokens when a quoted token (single or double quoted) is immediately followed by a token that is not a delimiter. This means characters appear right after a closing quote without the expected separator, which indicates malformed quoting in a structured config value.","triggerScenarios":"Config values like 'a'b,c (text after closing quote) or \"key\":value:extra where a quote is followed by non-delimiter text. The tokenizer detected a quoted segment followed by more content on the same logical segment.","commonSituations":"Partially quoting a value: my.list: 'item1'item2;item3. Mixing quoted and unquoted segments in a list/map value. Stray quotes from copy-paste or shell escaping leaking into the config.","solutions":["Ensure quoted segments are either fully self-contained or followed by the delimiter (',' or ';' or ':').","If a value contains both quotes and delimiters, quote the entire value and escape internal quotes by doubling them.","Remove stray quote characters that don't open/close a complete segment."],"exampleFix":"# before\nmy.list: 'item1'item2;item3\n\n# after\nmy.list: item1;item2;item3","handlingStrategy":"validation","validationCode":"// Quick check: after a closing quote, only a delimiter or end-of-string should follow\nString v = rawValue;\nfor (int i = 0; i < v.length(); i++) {\n    char c = v.charAt(i);\n    if ((c == '\\'' || c == '\"')) {\n        int close = v.indexOf(c, i + 1);\n        if (close >= 0 && close + 1 < v.length()) {\n            char next = v.charAt(close + 1);\n            if (next != ',' && next != ';' && next != ':') {\n                throw new IllegalArgumentException(\"Illegal quoting at position \" + close);\n            }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    StructuredOptionsSplitter.splitEscaped(value, delimiter);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Illegal quoting\")) { /* reformat value */ }\n}","preventionTips":["Don't mix quoted and unquoted text in a single segment.","Quote entire values, not partial ones.","Escape internal quotes by doubling."],"tags":["configuration","structured-parsing","quoting"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}