{"record":{"id":"97ca4fb1573d2604","repo":"elastic/elasticsearch","slug":"gap-policy-must-not-be-null-name","errorCode":null,"errorMessage":"[gap_policy] must not be null: [{name}]","messagePattern":"\\[gap_policy\\] must not be null: \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSortPipelineAggregationBuilder.java","lineNumber":128,"sourceCode":"    public BucketSortPipelineAggregationBuilder from(int from) {\n        if (from < 0) {\n            throw new IllegalArgumentException(\"[\" + FROM.getPreferredName() + \"] must be a non-negative integer: [\" + from + \"]\");\n        }\n        this.from = from;\n        return this;\n    }\n\n    public BucketSortPipelineAggregationBuilder size(Integer size) {\n        if (size != null && size <= 0) {\n            throw new IllegalArgumentException(\"[\" + SIZE.getPreferredName() + \"] must be a positive integer: [\" + size + \"]\");\n        }\n        this.size = size;\n        return this;\n    }\n\n    public BucketSortPipelineAggregationBuilder gapPolicy(GapPolicy gapPolicy) {\n        if (gapPolicy == null) {\n            throw new IllegalArgumentException(\"[\" + GAP_POLICY.getPreferredName() + \"] must not be null: [\" + name + \"]\");\n        }\n        this.gapPolicy = gapPolicy;\n        return this;\n    }\n\n    @Override\n    protected PipelineAggregator createInternal(Map<String, Object> metadata) {\n        return new BucketSortPipelineAggregator(name, sorts, from, size, gapPolicy, metadata);\n    }\n\n    @Override\n    protected void validate(ValidationContext context) {\n        context.validateHasParent(NAME, name);\n        if (sorts.isEmpty() && size == null && from == 0) {\n            context.addValidationError(\n                \"[\"\n                    + name\n                    + \"] is configured to perform nothing. Please set either of \"","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSortPipelineAggregationBuilder.java#L110-L146","documentation":"Error \"[gap_policy] must not be null: [{name}]\" thrown in elastic/elasticsearch.","triggerScenarios":"Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSortPipelineAggregationBuilder.java:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}