{"record":{"id":"461e8183648c3ccb","repo":"elastic/elasticsearch","slug":"field-is-null-cannot-be-converted-to-type","errorCode":null,"errorMessage":"Field [{}] is null, cannot be converted to type [{}]","messagePattern":"Field \\[(.+?)\\] is null, cannot be converted to type \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java","lineNumber":193,"sourceCode":"    }\n\n    Type getConvertType() {\n        return convertType;\n    }\n\n    boolean isIgnoreMissing() {\n        return ignoreMissing;\n    }\n\n    @Override\n    public IngestDocument execute(IngestDocument document) {\n        Object oldValue = document.getFieldValue(field, Object.class, ignoreMissing);\n        Object newValue;\n\n        if (oldValue == null && ignoreMissing) {\n            return document;\n        } else if (oldValue == null) {\n            throw new IllegalArgumentException(\"Field [\" + field + \"] is null, cannot be converted to type [\" + convertType + \"]\");\n        }\n\n        if (oldValue instanceof List<?> list) {\n            List<Object> newList = new ArrayList<>(list.size());\n            for (Object value : list) {\n                newList.add(convertType.convert(value));\n            }\n            newValue = newList;\n        } else {\n            newValue = convertType.convert(oldValue);\n        }\n        document.setFieldValue(targetField, newValue);\n        return document;\n    }\n\n    @Override\n    public String getType() {\n        return TYPE;","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java#L175-L211","documentation":"Thrown by ConvertProcessor.execute when the configured field resolves to null and 'ignore_missing' is false (the default). The processor explicitly distinguishes null from missing: it asks for the value with the ignoreMissing flag, and only returns early if both the value is null AND ignore_missing is true. Any other null result is treated as an unrecoverable conversion failure.","triggerScenarios":"A document where the configured 'field' exists but is explicitly JSON null, or where the field is absent and the pipeline did not set 'ignore_missing: true'. The convert processor's default for ignore_missing is false.","commonSituations":"Optional fields that are sometimes omitted by producers; documents that explicitly carry null after a previous rename or remove; pipelines built before the ignore_missing option existed; mixed schemas where some documents have the field and others do not.","solutions":["Add 'ignore_missing: true' to the convert processor configuration so absent or null fields skip the processor instead of failing.","Ensure the upstream producer populates the field, or add a 'set' processor with a default value before the convert step.","Use a pipeline 'on_failure' block to redirect such documents to a dead-letter index."],"exampleFix":"// before\n{\"convert\": {\"field\": \"price\", \"type\": \"float\"}}\n// after\n{\"convert\": {\"field\": \"price\", \"type\": \"float\", \"ignore_missing\": true}}","handlingStrategy":"validation","validationCode":"// Defensive: set ignore_missing on every convert processor by default in pipeline templates.\n{\"convert\": {\"field\": \"price\", \"type\": \"float\", \"ignore_missing\": true}}","typeGuard":null,"tryCatchPattern":"// Pipeline on_failure to catch the rare null field that still sneaks through:\n{\"on_failure\": [{\"index\": {\"index\": \"ingest-dlq\"}}]}","preventionTips":["Default to 'ignore_missing: true' for optional fields in shared pipeline templates.","Audit pipelines for convert processors missing the ignore_missing option.","Where absence is meaningful, route via on_failure instead of dropping."],"tags":["ingest","convert-processor","null-handling","config"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}