{"record":{"id":"ada64b6beaf7f387","repo":"elastic/elasticsearch","slug":"field-is-null-cannot-split","errorCode":null,"errorMessage":"field [{}] is null, cannot split.","messagePattern":"field \\[(.+?)\\] is null, cannot split\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/SplitProcessor.java","lineNumber":82,"sourceCode":"        return ignoreMissing;\n    }\n\n    boolean isPreserveTrailing() {\n        return preserveTrailing;\n    }\n\n    String getTargetField() {\n        return targetField;\n    }\n\n    @Override\n    public IngestDocument execute(IngestDocument document) {\n        String oldVal = document.getFieldValue(field, String.class, ignoreMissing);\n\n        if (oldVal == null && ignoreMissing) {\n            return document;\n        } else if (oldVal == null) {\n            throw new IllegalArgumentException(\"field [\" + field + \"] is null, cannot split.\");\n        }\n\n        String[] strings = oldVal.split(separator, preserveTrailing ? -1 : 0);\n        List<String> splitList = new ArrayList<>(strings.length);\n        Collections.addAll(splitList, strings);\n        document.setFieldValue(targetField, splitList);\n        return document;\n    }\n\n    @Override\n    public String getType() {\n        return TYPE;\n    }\n\n    public static class Factory implements Processor.Factory {\n        @Override\n        public SplitProcessor create(\n            Map<String, Processor.Factory> registry,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/SplitProcessor.java#L64-L100","documentation":"Thrown by SplitProcessor.execute when the source field resolves to null and ignore_missing is false (the default). The processor needs a string to split on the separator, so a null value is rejected.","triggerScenarios":"Configuring the split processor on a field that is absent or null in the document, with ignore_missing omitted or set to false.","commonSituations":"Optional string fields that are sometimes absent. Fields populated conditionally by upstream processors. Data quality gaps in the source.","solutions":["Set ignore_missing: true in the split processor config to skip null fields.","Pre-populate the field with an empty string using a set processor.","Use an 'if' condition on the processor to skip documents where the field is absent."],"exampleFix":"// before\n{\n  \"split\": { \"field\": \"tags\", \"separator\": \",\", \"target_field\": \"tags_list\" }\n}\n// after\n{\n  \"split\": { \"field\": \"tags\", \"separator\": \",\", \"target_field\": \"tags_list\", \"ignore_missing\": true }\n}","handlingStrategy":"validation","validationCode":"// Set ignore_missing: true on the split processor, or pre-check\nObject val = document.getFieldValue(\"tags\", Object.class, true);\nif (val == null) {\n    // skip split; or configure ignore_missing: true\n}","typeGuard":"boolean hasSplittableString(IngestDocument doc, String field) {\n    Object v = doc.getFieldValue(field, Object.class, true);\n    return v instanceof String;\n}","tryCatchPattern":"try {\n    // run split processor\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"is null, cannot split\")) {\n        // enable ignore_missing: true or add a guard\n    } else { throw e; }\n}","preventionTips":["Set ignore_missing: true when the source field is optional.","Pre-populate the field with an empty string using a set processor if needed.","Add an 'if' condition to skip documents where the field is absent."],"tags":["elasticsearch","ingest-pipeline","split","validation","null-handling"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}