{"record":{"id":"d014a8773e7c2f20","repo":"apache/flink","slug":"format-cannot-define-a-quote-character-and-disable","errorCode":null,"errorMessage":"Format cannot define a quote character and disabled quote character at the same time.","messagePattern":"Format cannot define a quote character and disabled quote character at the same time\\.","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvCommons.java","lineNumber":58,"sourceCode":"import static org.apache.flink.formats.csv.CsvFormatOptions.NULL_LITERAL;\nimport static org.apache.flink.formats.csv.CsvFormatOptions.QUOTE_CHARACTER;\nimport static org.apache.flink.formats.csv.CsvFormatOptions.TRIM_SPACES;\nimport static org.apache.flink.formats.csv.CsvFormatOptions.WRITE_BIGDECIMAL_IN_SCIENTIFIC_NOTATION;\n\n/** A class with common CSV format constants and utility methods. */\nclass CsvCommons {\n\n    public static final String IDENTIFIER = \"csv\";\n\n    // ------------------------------------------------------------------------\n    //  Validation\n    // ------------------------------------------------------------------------\n\n    static void validateFormatOptions(ReadableConfig tableOptions) {\n        final boolean hasQuoteCharacter = tableOptions.getOptional(QUOTE_CHARACTER).isPresent();\n        final boolean isDisabledQuoteCharacter = tableOptions.get(DISABLE_QUOTE_CHARACTER);\n        if (isDisabledQuoteCharacter && hasQuoteCharacter) {\n            throw new ValidationException(\n                    \"Format cannot define a quote character and disabled quote character at the same time.\");\n        }\n        // Validate the option value must be a single char.\n        validateCharacterVal(tableOptions, FIELD_DELIMITER, true);\n        validateCharacterVal(tableOptions, ARRAY_ELEMENT_DELIMITER);\n        validateCharacterVal(tableOptions, QUOTE_CHARACTER);\n        validateCharacterVal(tableOptions, ESCAPE_CHARACTER);\n    }\n\n    /** Validates the option {@code option} value must be a Character. */\n    private static void validateCharacterVal(\n            ReadableConfig tableOptions, ConfigOption<String> option) {\n        validateCharacterVal(tableOptions, option, false);\n    }\n\n    /**\n     * Validates the option {@code option} value must be a Character.\n     *","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvCommons.java#L40-L76","documentation":"Validation error from CsvCommons.validateFormatOptions(): the CSV format options simultaneously specify a 'csv.quote-character' value and set 'csv.disable-quote-character' to true. These are contradictory — one demands a specific quote char, the other disables quoting entirely — so table creation fails fast with ValidationException before any job runs.","triggerScenarios":"A WITH clause containing both 'csv.quote-character'='\"' (or any char) and 'csv.disable-quote-character'='true'. Raised during FactoryUtil option validation when the Csv format factory creates either a source or sink.","commonSituations":"Copy-pasted format option blocks where users append disable-quote-character to an existing template that already sets a quote character; YAML/SQL templating that merges option maps; intent to switch to unquoted CSV without removing the old option.","solutions":["If quoted CSV is desired, remove 'csv.disable-quote-character'.","If unquoted CSV is desired, remove 'csv.quote-character' and keep 'csv.disable-quote-character'='true'.","Lint DDLs that combine csv.* options before submission."],"exampleFix":"-- before\n'format'='csv',\n'csv.quote-character'='|',\n'csv.disable-quote-character'='true'\n\n-- after\n'format'='csv',\n'csv.quote-character'='|'","handlingStrategy":"validation","validationCode":"// Lint options before table creation:\nboolean hasQuote = options.toMap().containsKey(\"csv.quote-character\");\nboolean disableQuote = \"true\"\n    .equalsIgnoreCase(options.toMap().getOrDefault(\"csv.disable-quote-character\", \"false\"));\nif (hasQuote && disableQuote) {\n    throw new ValidationException(\"Remove one of csv.quote-character / csv.disable-quote-character\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep CSV option blocks in a single reviewed template","Decide quoting policy once per pipeline and encode it in shared DDL macros"],"tags":["csv","validation","format-options","ddl"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}