Request to session that doesnt exist is a 400 insteed of 404 #2074

Closed
opened 2026-02-16 17:34:02 -05:00 by yindo · 1 comment
Owner

Originally created by @wojons on GitHub (Oct 13, 2025).

Originally assigned to: @rekram1-node on GitHub.

I would think that the request its self is valid formated but the endpoint its going to doesn't exist so a 404 might be better and more clear saving 400 for when its malformed?

curl -v localhost:46837/session/ses_621f869e1ffe3REHbDG1LbM3oy/message -H "Content-Type: application/json" -H "X-API-KEY: dummy_key" -d '{"parts":[{"type":"text", "text":"Test message to stale session"}]}'
* Host localhost:46837 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:46837...
* connect to ::1 port 46837 from ::1 port 45780 failed: Connection refused
*   Trying 127.0.0.1:46837...
* Connected to localhost (127.0.0.1) port 46837
> POST /session/ses_621f869e1ffe3REHbDG1LbM3oy/message HTTP/1.1
> Host: localhost:46837
> User-Agent: curl/8.5.0
> Accept: */*
> Content-Type: application/json
> X-API-KEY: dummy_key
> Content-Length: 67
> 
< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Access-Control-Allow-Origin: *
< Date: Mon, 13 Oct 2025 15:32:49 GMT
< Content-Length: 216
< 
* Connection #0 to host localhost left intact
{"name":"UnknownError","data":{"message":"Error: ENOENT: no such file or directory, open '/config/.local/share/opencode/storage/session/76d332bae749cb0681ff9d0dca0aa873574d3d55/ses_621f869e1ffe3REHbDG1LbM3oy.json'"}}
Originally created by @wojons on GitHub (Oct 13, 2025). Originally assigned to: @rekram1-node on GitHub. I would think that the request its self is valid formated but the endpoint its going to doesn't exist so a 404 might be better and more clear saving 400 for when its malformed? ``` bash curl -v localhost:46837/session/ses_621f869e1ffe3REHbDG1LbM3oy/message -H "Content-Type: application/json" -H "X-API-KEY: dummy_key" -d '{"parts":[{"type":"text", "text":"Test message to stale session"}]}' * Host localhost:46837 was resolved. * IPv6: ::1 * IPv4: 127.0.0.1 * Trying [::1]:46837... * connect to ::1 port 46837 from ::1 port 45780 failed: Connection refused * Trying 127.0.0.1:46837... * Connected to localhost (127.0.0.1) port 46837 > POST /session/ses_621f869e1ffe3REHbDG1LbM3oy/message HTTP/1.1 > Host: localhost:46837 > User-Agent: curl/8.5.0 > Accept: */* > Content-Type: application/json > X-API-KEY: dummy_key > Content-Length: 67 > < HTTP/1.1 400 Bad Request < Content-Type: application/json < Access-Control-Allow-Origin: * < Date: Mon, 13 Oct 2025 15:32:49 GMT < Content-Length: 216 < * Connection #0 to host localhost left intact {"name":"UnknownError","data":{"message":"Error: ENOENT: no such file or directory, open '/config/.local/share/opencode/storage/session/76d332bae749cb0681ff9d0dca0aa873574d3d55/ses_621f869e1ffe3REHbDG1LbM3oy.json'"}} ```
yindo closed this issue 2026-02-16 17:34:02 -05:00
Author
Owner

@rekram1-node commented on GitHub (Oct 15, 2025):

will be fixed in next release

@rekram1-node commented on GitHub (Oct 15, 2025): will be fixed in next release
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2074