{"record":{"id":"1bee04c7664230dc","repo":"apache/flink","slug":"json-format-doesn-t-support-failonmissingfield-and","errorCode":null,"errorMessage":"JSON format doesn't support failOnMissingField and ignoreParseErrors are both enabled.","messagePattern":"JSON format doesn't support failOnMissingField and ignoreParseErrors are both enabled\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/AbstractJsonDeserializationSchema.java","lineNumber":90,"sourceCode":"    protected transient ObjectMapper objectMapper;\n\n    /** Timestamp format specification which is used to parse timestamp. */\n    private final TimestampFormat timestampFormat;\n\n    private final boolean hasDecimalType;\n\n    private transient Collector<RowData> collector;\n\n    private transient List<RowData> reusableCollectList;\n\n    public AbstractJsonDeserializationSchema(\n            RowType rowType,\n            TypeInformation<RowData> resultTypeInfo,\n            boolean failOnMissingField,\n            boolean ignoreParseErrors,\n            TimestampFormat timestampFormat) {\n        if (ignoreParseErrors && failOnMissingField) {\n            throw new IllegalArgumentException(\n                    \"JSON format doesn't support failOnMissingField and ignoreParseErrors are both enabled.\");\n        }\n        this.resultTypeInfo = checkNotNull(resultTypeInfo);\n        this.failOnMissingField = failOnMissingField;\n        this.ignoreParseErrors = ignoreParseErrors;\n        this.timestampFormat = timestampFormat;\n        this.hasDecimalType = LogicalTypeChecks.hasNested(rowType, t -> t instanceof DecimalType);\n    }\n\n    @Override\n    public void open(InitializationContext context) throws Exception {\n        objectMapper =\n                JacksonMapperFactory.createObjectMapper()\n                        .configure(\n                                JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(),\n                                true);\n        if (hasDecimalType) {\n            objectMapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/AbstractJsonDeserializationSchema.java#L72-L108","documentation":"IllegalArgumentException from the AbstractJsonDeserializationSchema constructor when both failOnMissingField=true and ignoreParseErrors=true. These options are contradictory: one demands strict schema adherence (fail on a missing field), the other demands leniency (skip bad records). The JSON format refuses to construct the deserializer in that state.","triggerScenarios":"Programmatically building JsonRowDataDeserializationSchema (or a subclass) with failOnMissingField=true and ignoreParseErrors=true; constructing the schema directly bypasses the Discovery/Factory validation that would normally reject this earlier at DDL time.","commonSituations":"Custom connector code creating the deserializer by hand; copying test code that sets both flags; upgrading where defaults changed and a hardcoded option set now conflicts.","solutions":["Set ignoreParseErrors=false if you want strict missing-field enforcement","Or set failOnMissingField=false if you want malformed rows skipped instead of failing the job","Prefer going through the JSON format factory (DDL WITH options) so validateDecodingFormatOptions rejects the combo early with a clearer message"],"exampleFix":"// before\nnew JsonRowDataDeserializationSchema(rowType, typeInfo, true /*failOnMissingField*/, true /*ignoreParseErrors*/, TimestampFormat.SQL);\n\n// after: pick one strictness mode\nnew JsonRowDataDeserializationSchema(rowType, typeInfo, true, false, TimestampFormat.SQL);","handlingStrategy":"validation","validationCode":"if (failOnMissingField && ignoreParseErrors) {\n    throw new IllegalArgumentException(\n        \"Choose one: failOnMissingField (strict) OR ignoreParseErrors (lenient)\");\n}","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) {\n    // surface config conflict to operator with actionable message\n}","preventionTips":["Centralize option assembly so the pair is validated in one place","Prefer the format factory/DDL path where validateDecodingFormatOptions runs automatically"],"tags":["flink","json","deserialization","config","validation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}