<!-- XE-0079 · api: GET /leases invalid state error lists five states and omits the valid "expired" (Minor) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0079>. The page is the record; this is the same page for reading.*

XE-0079 · Bounty

# api: GET /leases invalid state error lists five states and omits the valid "expired" (Minor)

Accepted
claimed Minor
[xe#79](https://github.com/xeprotocol/xe/issues/79)
filed 2026-10-26 20:34 UTC
by BoomGone

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Minor

Area
:   Node / API

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-10 11:38 UTC

Told
:   2026-11-10 00:15 UTC

### Patches

- [xe#113](https://github.com/xeprotocol/xe/pull/113) open by arturbarszcz78
  fix(api): include expired in invalid lease state error message (#79)

### History

- [61390](https://bounty.xe.network/log/61390) 2026-11-10 00:15 UTC reply.mirrored
- [61347](https://bounty.xe.network/log/61347) 2026-11-10 00:15 UTC reply.sent
- [18228](https://bounty.xe.network/log/18228) 2026-11-07 16:10 UTC proposal.adopted
- [18227](https://bounty.xe.network/log/18227) 2026-11-07 16:10 UTC ticket.award
- [18226](https://bounty.xe.network/log/18226) 2026-11-07 16:10 UTC proposal.rejected
- [6904](https://bounty.xe.network/log/6904) 2026-11-05 13:45 UTC proposal.created
- [1834](https://bounty.xe.network/log/1834) 2026-11-02 19:16 UTC proposal.created
- [1484](https://bounty.xe.network/log/1484) 2026-11-02 10:11 UTC note.added
- [738](https://bounty.xe.network/log/738) 2026-10-29 14:22 UTC note.added
- [737](https://bounty.xe.network/log/737) 2026-10-29 14:22 UTC ticket.facts area
- [630](https://bounty.xe.network/log/630) 2026-10-29 14:05 UTC github.labels
- [418](https://bounty.xe.network/log/418) 2026-10-29 14:04 UTC ticket.status triaging → accepted

[Full history](https://bounty.xe.network/log?ref=XE-0079) · [JSON](https://bounty.xe.network/v1/tickets/XE-0079) · [markdown](https://bounty.xe.network/XE-0079.md)

### Report

- Suggested tier: Minor ("misleading log messages")
- Area: HTTP API `/leases`
- Found: 2026-10-26, node `xe/92d83d1`, repo master `9787859`

## 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

**arturbarszcz78**2026-10-28 06:48 UTCgithub

\[comment from a blocked account removed\]

**XE desk**team2026-11-10 00:15 UTCgithub

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.
