{"record":{"id":"fd7d4f530253f1b3","repo":"elastic/elasticsearch","slug":"field-is-null-cannot-parse","errorCode":null,"errorMessage":"field [{}] is null, cannot parse.","messagePattern":"field \\[(.+?)\\] is null, cannot parse\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java","lineNumber":201,"sourceCode":"\n    // For tests only\n    RelativeByteSizeValue getMaxFieldSizeFromNode() {\n        return maxFieldSizeFromNode;\n    }\n\n    @Override\n    public IngestDocument execute(IngestDocument ingestDocument) {\n        Map<String, Object> additionalFields = new HashMap<>();\n\n        Object fieldValue = ingestDocument.getFieldValue(field, Object.class, ignoreMissing);\n        String resourceNameInput = null;\n        if (resourceName != null) {\n            resourceNameInput = ingestDocument.getFieldValue(resourceName, String.class, true);\n        }\n        if (fieldValue == null && ignoreMissing) {\n            return ingestDocument;\n        } else if (fieldValue == null) {\n            throw new IllegalArgumentException(\"field [\" + field + \"] is null, cannot parse.\");\n        }\n        final int rawBytes = ingestDocument.getFieldValueRawBytesLength(field, fieldValue);\n        if (attachmentMetrics.get() != null) {\n            attachmentMetrics.get().recordRawBytesReceived(rawBytes);\n        }\n        checkMaxAttachmentFieldSize(rawBytes);\n        byte[] input = ingestDocument.getFieldValueAsBytes(field, fieldValue);\n\n        Integer indexedCharsValue = this.indexedChars;\n\n        if (indexedCharsField != null) {\n            // If the user provided the number of characters to be extracted as part of the document, we use it\n            indexedCharsValue = ingestDocument.getFieldValue(indexedCharsField, Integer.class, true);\n            if (indexedCharsValue == null) {\n                // If the field does not exist we fall back to the global limit\n                indexedCharsValue = this.indexedChars;\n            }\n        }","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java#L183-L219","documentation":"IllegalArgumentException from AttachmentProcessor#execute when the configured source field is null/absent and ignore_missing is false. The processor cannot parse a missing binary, so it fails the document rather than silently passing it through.","triggerScenarios":"An ingest document reaching the attachment processor has no value at the configured 'field' path (getFieldValue returns null with ignoreMissing=false). The else-if branch throws.","commonSituations":"Heterogeneous documents where only some carry attachments; upstream enrichment step that was supposed to populate the field ran late or failed; misconfigured field name.","solutions":["Set ignore_missing: true on the attachment processor so missing fields pass through unchanged","Ensure the source field is populated for every document (fix upstream producers)","Branch documents via a conditional (if) pipeline so only attachment-bearing docs hit this processor"],"exampleFix":"// before\nPUT _ingest/pipeline/attach\n{\"processors\":[{\"attachment\":{\"field\":\"data\"}}]}\n// after\n{\"processors\":[{\"attachment\":{\"field\":\"data\",\"ignore_missing\":true}}]}","handlingStrategy":"validation","validationCode":"// If the field may be absent, configure ignore_missing:true when creating the processor:\nMap<String,Object> cfg = Map.of(\"field\",\"data\",\"ignore_missing\",true);","typeGuard":null,"tryCatchPattern":"try { processor.execute(doc); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"is null, cannot parse\")) { /* set ignore_missing or fix producer */ }\n    else throw e;\n}","preventionTips":["Set ignore_missing:true for optional attachment fields","Use a conditional pipeline so only docs with the field run this processor","Validate document shape upstream before ingest"],"tags":["ingest","attachment","null-field","ignore-missing"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}