{"record":{"id":"fb0de1d1ea6a1295","repo":"apache/flink","slug":"could-not-split-string-quoting-was-not-closed-pro","errorCode":null,"errorMessage":"Could not split string. Quoting was not closed properly.","messagePattern":"Could not split string\\. Quoting was not closed properly\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/configuration/StructuredOptionsSplitter.java","lineNumber":163,"sourceCode":"    }\n\n    private static int consumeInQuotes(\n            String string, char quote, int cursor, StringBuilder builder) {\n        for (int i = cursor + 1; i < string.length(); i++) {\n            char c = string.charAt(i);\n            if (c == quote) {\n                if (i + 1 < string.length() && string.charAt(i + 1) == quote) {\n                    builder.append(c);\n                    i += 1;\n                } else {\n                    return i + 1;\n                }\n            } else {\n                builder.append(c);\n            }\n        }\n\n        throw new IllegalArgumentException(\n                \"Could not split string. Quoting was not closed properly.\");\n    }\n\n    private static int consumeUnquoted(\n            String string, char delimiter, int cursor, StringBuilder builder) {\n        int i;\n        for (i = cursor; i < string.length(); i++) {\n            char c = string.charAt(i);\n            if (c == delimiter) {\n                return i;\n            }\n\n            builder.append(c);\n        }\n\n        return i;\n    }\n","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/configuration/StructuredOptionsSplitter.java#L145-L181","documentation":"Thrown by StructuredOptionsSplitter.consumeInQuotes when the end of the string is reached without finding a closing quote character. The method scans from the opening quote to the matching close; hitting end-of-string means the quote was never terminated.","triggerScenarios":"Config values with an unclosed quote: my.map: 'key:value (missing closing quote). Also when an escaped quote ('') is intended but only one quote is present, or the closing quote was accidentally deleted.","commonSituations":"Editing YAML config and forgetting to close a quoted string. Shell quoting that strips the closing quote. Values that begin with a quote due to template substitution errors.","solutions":["Add the matching closing quote (single or double) to complete the quoted segment.","If the value shouldn't be quoted, remove the opening quote.","Escape internal single quotes by doubling ('') when using single-quote wrapping."],"exampleFix":"# before\nmy.value: 'unclosed\n\n# after\nmy.value: 'closed'","handlingStrategy":"validation","validationCode":"long single = rawValue.chars().filter(c -> c == '\\'').count();\nlong dbl = rawValue.chars().filter(c -> c == '\"').count();\nif (single % 2 != 0 || dbl % 2 != 0) {\n    throw new IllegalArgumentException(\"Unclosed quote in value\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    StructuredOptionsSplitter.splitEscaped(value, delimiter);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"not closed properly\")) { /* add closing quote */ }\n}","preventionTips":["Always close opened quotes.","Use a YAML linter that checks quote balance.","Prefer YAML native structures over hand-rolled delimited strings."],"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"}