{"record":{"id":"14d096d36796627d","repo":"elastic/elasticsearch","slug":"field-is-null-cannot-process-it","errorCode":null,"errorMessage":"field [{}] is null, cannot process it.","messagePattern":"field \\[(.+?)\\] is null, cannot process it\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/AbstractStringProcessor.java","lineNumber":60,"sourceCode":"    }\n\n    boolean isIgnoreMissing() {\n        return ignoreMissing;\n    }\n\n    String getTargetField() {\n        return targetField;\n    }\n\n    @Override\n    public final IngestDocument execute(IngestDocument document) {\n        Object val = document.getFieldValue(field, Object.class, ignoreMissing);\n        Object newValue;\n\n        if (val == null && ignoreMissing) {\n            return document;\n        } else if (val == null) {\n            throw new IllegalArgumentException(\"field [\" + field + \"] is null, cannot process it.\");\n        }\n\n        if (val instanceof List<?> list) {\n            List<Object> newList = new ArrayList<>(list.size());\n            for (Object value : list) {\n                if (value instanceof String string) {\n                    newList.add(process(string));\n                } else {\n                    throw new IllegalArgumentException(\n                        \"value [\"\n                            + value\n                            + \"] of type [\"\n                            + value.getClass().getName()\n                            + \"] in list field [\"\n                            + field\n                            + \"] cannot be cast to [\"\n                            + String.class.getName()\n                            + \"]\"","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/AbstractStringProcessor.java#L42-L78","documentation":"IllegalArgumentException from AbstractStringProcessor#execute (base for uppercase, lowercase, append, trim, etc.) when the source field is null and ignore_missing is false. The base class centralizes null-handling for all single-string-input processors.","triggerScenarios":"Any processor extending AbstractStringProcessor receives a document missing the configured 'field'; getFieldValue returns null and ignoreMissing is false, so the else-if branch throws.","commonSituations":"Optional fields processed unconditionally; upstream producer stopped emitting a field after a schema change; field name typo.","solutions":["Set ignore_missing: true on the processor","Guarantee the field is present (fix producers / add a default via set processor)","Use an if condition to skip the processor when the field is absent"],"exampleFix":"// before\n{\"processors\":[{\"uppercase\":{\"field\":\"message\"}}]}\n// after\n{\"processors\":[{\"uppercase\":{\"field\":\"message\",\"ignore_missing\":true}}]}","handlingStrategy":"validation","validationCode":"// If the field is optional, set ignore_missing:true in every AbstractStringProcessor config:\nMap<String,Object> cfg = Map.of(\"field\",\"message\",\"ignore_missing\",true);","typeGuard":null,"tryCatchPattern":"try { processor.execute(doc); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"is null, cannot process\")) { /* set ignore_missing or fix schema */ }\n    else throw e;\n}","preventionTips":["Default ignore_missing to true for processors on optional fields","Validate the source schema so processors only run on present fields","Use conditional (if) processors to gate string processors on field presence"],"tags":["ingest","string-processor","null-field","ignore-missing"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}