api: GET /leases invalid state error lists five states and omits the valid "expired" (Minor)
Report
- Suggested tier: Minor ("misleading log messages")
- Area: HTTP API
/leases - Found: 2026-10-26, node
xe/92d83d1, repo master9787859
Summary
GET /leases?state=<bad> answers:
400 {"error":"invalid state: must be one of created, accepted, settled, cancelled, unfulfilled"}
The message leaves out expired, which is a valid filter: it is in core.ValidLeaseStates (core/types.go:194), in the OpenAPI enum for state, in the docs ("Filter with ?state=created|accepted|settled|cancelled|unfulfilled|expired"), and GET /leases?state=expired returns 200. A user or agent that reads the error to correct its request is told expired does not exist.
Steps to reproduce
curl -s 'https://test.network/api/v1/leases?state=bogus' # message lists 5 states
curl -s 'https://test.network/api/v1/leases?state=expired' -o /dev/null -w '%{http_code}\n' # 200
Same message from the node directly (https://ldn.core.test.network/leases?state=bogus).
Cause
The string is hardcoded in handleGetLeases (api/handler.go) and was not updated when LeaseExpired was added.
Suggested fix
Build the message from core.ValidLeaseStates, or add expired to the string.
Payout
XE address: 6591eab453dbd93b27e2cd674712f94b42d9e7e4d52980b966fa6da4ccd832dc (same as #75).
Thread
[comment from a blocked account removed]
Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0079.