{"record":{"id":"aed01234593c4eba","repo":"apache/flink","slug":"fail-on-missing-field-and-ignore-parse-errors-shou","errorCode":null,"errorMessage":"fail-on-missing-field and ignore-parse-errors shouldn't both be true.","messagePattern":"fail-on-missing-field and ignore-parse-errors shouldn't both be true\\.","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonFormatOptionsUtil.java","lineNumber":108,"sourceCode":"                return JsonFormatOptions.MapNullKeyMode.LITERAL;\n            default:\n                throw new TableException(\n                        String.format(\n                                \"Unsupported map null key handling mode '%s'. Validator should have checked that.\",\n                                mapNullKeyMode));\n        }\n    }\n\n    // --------------------------------------------------------------------------------------------\n    // Validation\n    // --------------------------------------------------------------------------------------------\n\n    /** Validator for json decoding format. */\n    public static void validateDecodingFormatOptions(ReadableConfig tableOptions) {\n        boolean failOnMissingField = tableOptions.get(FAIL_ON_MISSING_FIELD);\n        boolean ignoreParseErrors = tableOptions.get(IGNORE_PARSE_ERRORS);\n        if (ignoreParseErrors && failOnMissingField) {\n            throw new ValidationException(\n                    FAIL_ON_MISSING_FIELD.key()\n                            + \" and \"\n                            + IGNORE_PARSE_ERRORS.key()\n                            + \" shouldn't both be true.\");\n        }\n        validateTimestampFormat(tableOptions);\n    }\n\n    /** Validator for json encoding format. */\n    public static void validateEncodingFormatOptions(ReadableConfig tableOptions) {\n        // validator for {@link MAP_NULL_KEY_MODE}\n        Set<String> nullKeyModes =\n                Arrays.stream(JsonFormatOptions.MapNullKeyMode.values())\n                        .map(Objects::toString)\n                        .collect(Collectors.toSet());\n        if (!nullKeyModes.contains(tableOptions.get(MAP_NULL_KEY_MODE).toUpperCase())) {\n            throw new ValidationException(\n                    String.format(","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonFormatOptionsUtil.java#L90-L126","documentation":"ValidationException from JsonFormatOptionsUtil.validateDecodingFormatOptions, raised at table-creation time when both 'json.ignore-parse-errors' and 'json.fail-on-missing-field' are true. They encode opposite strictness policies, so the format refuses the DDL. This is the early, user-facing variant of the constructor check in AbstractJsonDeserializationSchema.","triggerScenarios":"CREATE TABLE ... WITH ('format'='json', 'json.ignore-parse-errors'='true', 'json.fail-on-missing-field'='true'); also programmatic discovery with both flags enabled.","commonSituations":"Copy-pasted WITH clauses hardened for both dirty and sparse data; enabling ignore-parse-errors to survive dirty feeds while leaving fail-on-missing-field from an earlier strict setup.","solutions":["If data quality matters more than uptime: drop 'json.ignore-parse-errors' (or set false) and keep fail-on-missing-field=true","If uptime matters more: set 'json.fail-on-missing-field'='false' and keep ignore-parse-errors=true","Re-create the table after fixing the options and verify with SHOW CREATE TABLE"],"exampleFix":"-- before\nWITH (\n  'format'='json',\n  'json.ignore-parse-errors'='true',\n  'json.fail-on-missing-field'='true'\n)\n\n-- after\nWITH (\n  'format'='json',\n  'json.ignore-parse-errors'='true',\n  'json.fail-on-missing-field'='false'\n)","handlingStrategy":"validation","validationCode":"JsonFormatOptionsUtil.validateDecodingFormatOptions(tableOptions); // throws early with option keys in the message","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide the strictness policy once (strict vs tolerant) and set exactly one flag","Codify WITH-clause templates so conflicting pairs cannot be combined"],"tags":["flink","json","ddl","options","validation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}