Skip to content

Return 400, not 500, for well-formed but non-existent ids#407

Merged
JonJagger merged 1 commit into
mainfrom
nonexistent-id-returns-400-not-500
Jun 18, 2026
Merged

Return 400, not 500, for well-formed but non-existent ids#407
JonJagger merged 1 commit into
mainfrom
nonexistent-id-returns-400-not-500

Conversation

@JonJagger

Copy link
Copy Markdown
Member

API endpoints that resolve an id raised a generic RuntimeError from the
manifest read when the id was well-formed but referenced nothing on disk
(eg kata_events for a non-existent kata-id). The global error handler maps
that to HTTP 500, telling the client the server broke when in fact the
request named something that does not exist.

Wrap each resolver (kata_version, group, cluster_manifest) so a missing
entity surfaces as a RequestError (HTTP 400), while genuine failures on an
entity that does exist are re-raised unchanged rather than masked as
"does not exist". cluster_hierarchy likewise now raises for an id matching
no kata, group or cluster instead of returning an empty hierarchy.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

  API endpoints that resolve an id raised a generic RuntimeError from the
  manifest read when the id was well-formed but referenced nothing on disk
  (eg kata_events for a non-existent kata-id). The global error handler maps
  that to HTTP 500, telling the client the server broke when in fact the
  request named something that does not exist.

  Wrap each resolver (kata_version, group, cluster_manifest) so a missing
  entity surfaces as a RequestError (HTTP 400), while genuine failures on an
  entity that does exist are re-raised unchanged rather than masked as
  "does not exist". cluster_hierarchy likewise now raises for an id matching
  no kata, group or cluster instead of returning an empty hierarchy.

  Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JonJagger JonJagger merged commit fbae360 into main Jun 18, 2026
8 checks passed
@JonJagger JonJagger deleted the nonexistent-id-returns-400-not-500 branch June 18, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant