opensearch-project/OpenSearch
Voir sur GitHub[BUG] Resize request should throw 4xx as part of validation failure for write block
Open
#19 026 ouverte le 11 août 2025
Cluster Managerbuggood first issue
Métriques du dépôt
- Stars
- (8 123 stars)
- Métriques de merge PR
- (Merge moyen 5j 9h) (266 PRs mergées en 30 j)
Description
Describe the bug
Currently as part of the resize request validation while creating a target index using MetadataCreateIndexService, it throws IllegalStateException that gets translated to 5xx. Here it should instead throw IllegalArgumentException which will be translated to 4xx. 5xx is usually treated as server side failure/error whereas 4xx will be wrong user input which fits well in this case.
Response:
HTTP/2 500 Internal Server Error
Date: Mon, 07 Jul 2025 15:48:17 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 315
Access-Control-Allow-Origin: *
{"error":{"root_cause":[{"type":"illegal_state_exception","reason":"index test-01 must block write operations to resize index. use \"index.blocks.write=true\""}],"type":"illegal_state_exception","reason":"index test-01 must block write operations to resize index. use \"index.blocks.write=true\""},"status":500}
Related component
No response
To Reproduce
- Submit request to shrink an existing index (test-01) without write block on it.
curl localhost:9200/test-01/_shrink/test-shrink-01
Expected behavior
OpenSearch should throw 4xx error instead of 5xx
Additional Details
N/A