{"record":{"id":"17b9fd6e22de4795","repo":"elastic/elasticsearch","slug":"no-data-stream-actions-specified-at-least-one-mus","errorCode":null,"errorMessage":"no data stream actions specified, at least one must be specified","messagePattern":"no data stream actions specified, at least one must be specified","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/data-streams/src/main/java/org/elasticsearch/datastreams/rest/RestModifyDataStreamsAction.java","lineNumber":64,"sourceCode":"    public List<Route> routes() {\n        return List.of(new Route(POST, \"/_data_stream/_modify\"));\n    }\n\n    @Override\n    protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {\n        ModifyDataStreamsAction.Request modifyDsRequest;\n        try (XContentParser parser = request.contentParser()) {\n            modifyDsRequest = ModifyDataStreamsAction.Request.PARSER.parse(\n                parser,\n                actions -> new ModifyDataStreamsAction.Request(\n                    RestUtils.getMasterNodeTimeout(request),\n                    RestUtils.getAckTimeout(request),\n                    actions\n                )\n            );\n        }\n        if (modifyDsRequest.getActions() == null || modifyDsRequest.getActions().isEmpty()) {\n            throw new IllegalArgumentException(\"no data stream actions specified, at least one must be specified\");\n        }\n        boolean hasDeleteIndexAction = modifyDsRequest.getActions()\n            .stream()\n            .anyMatch(action -> action.getType() == DataStreamAction.Type.DELETE_BACKING_INDEX);\n        if (hasDeleteIndexAction) {\n            if (clusterSupportsFeature.test(DataStreamFeatures.DATA_STREAMS_MODIFY_DELETE_INDEX) == false) {\n                throw new IllegalArgumentException(\"delete_backing_index is an unsupported action type for this mixed version cluster\");\n            }\n        }\n        return channel -> client.execute(ModifyDataStreamsAction.INSTANCE, modifyDsRequest, new RestToXContentListener<>(channel));\n    }\n\n    @Override\n    public Set<String> supportedCapabilities() {\n        return Set.of(\"data_streams.modify.delete_index\");\n    }\n}\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/data-streams/src/main/java/org/elasticsearch/datastreams/rest/RestModifyDataStreamsAction.java#L46-L82","documentation":"IllegalArgumentException from the REST handler for _modify_data_streams when the parsed request carries a null or empty 'actions' list. The endpoint requires at least one action (add backing index, delete backing index, etc.) to do anything meaningful.","triggerScenarios":"POST /_data_stream/_modify with a body like {\"actions\":[]} or with the actions field omitted entirely. The parser succeeds but the post-parse guard fails.","commonSituations":"Automation/template bug generating an empty actions array; client library serializing an empty list; testing the endpoint with a placeholder body.","solutions":["Supply at least one valid action object in the actions array (e.g. {\"delete_backing_index\":{\"data_stream\":\"...\",\"index\":\"...\"}})","Validate the actions list is non-empty in the client before sending"],"exampleFix":"// before\nPOST _data_stream/_modify {\"actions\":[]}\n// after\nPOST _data_stream/_modify\n{\"actions\":[{\"delete_backing_index\":{\"data_stream\":\"my-logs\",\"index\":\".ds-my-logs-2024-12-31-000001\"}}]}","handlingStrategy":"validation","validationCode":"// Client-side guard before sending the request:\nif (actions == null || actions.isEmpty()) {\n    throw new IllegalArgumentException(\"no data stream actions specified, at least one must be specified\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the actions list is non-empty in client code before serializing","Add a schema check in test fixtures that build modify requests","Log when a constructed request has zero actions to catch automation bugs early"],"tags":["data-streams","rest","validation","modify"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}