Skip to content

T-GIB9-not-found-status-in-generated-http

State: planning/draft · Impact: medium · Complexity: medium

Every handler error in the generated HTTP transport answers 500, whatever the actual error is. A missing note or plugin should answer 404. Today a client that reads status codes instead of body text cannot tell “not found” from a real server fault.

LocationRole today
solutions/determined/crates/determined-platform/src/api/transport/http/generated.rs:123-127fn err(msg: String) -> ApiError hardcodes StatusCode::INTERNAL_SERVER_ERROR for every handler error. File header: “Auto-generated HTTP route handlers. DO NOT EDIT.”
Cargo.toml:135Pins the external ontogen crate (git = "https://github.com/sksizer/rust-ontogen") whose axum-server emitter produces generated.rs, including err(). The mapping cannot be fixed by editing this repo’s copy — only by fixing the emitter and regenerating.
rust-ontogen docs/planning/epics/http-error-mapping.mdThe upstream E0003 epic for consumer-controlled HTTP error responses, with a design document behind it. This repo’s own backlog entry for the defect was retired into it.

err() maps each AppError variant to its own status: NotFound → 404, Invalid → 400, Upstream → 502, anything else → 500. A GET for a note or plugin that does not exist answers 404, not 500.

  1. Fix the emitter in rust-ontogen so it emits a per-variant status match instead of one hardcoded INTERNAL_SERVER_ERROR.
  2. Bump the pinned ontogen rev in this repo’s root Cargo.toml.
  3. Rebuild determined-platform so generated.rs regenerates from the new emitter; do not hand-edit the generated file.
  4. Verify the two known-open routes now answer 404: a note or plugin path that resolves to nothing in an empty vault, and a note path missing its .md suffix.
  5. Confirm the upstream E0003 epic records the fix once the emitter change lands.
AreaNote
Cargo.tomlBump the pinned ontogen rev to one carrying the per-variant status fix
solutions/determined/crates/determined-platform/src/api/transport/http/generated.rsRegenerated by the build, not hand-edited
solutions/determined/products/agent-pants/tests/e2e/consoleWatch.tsDrop the KNOWN_OPEN allowance for the 500-on-missing-note pattern once the API answers 404
  • AC-1: A GET for a note or plugin path that resolves to nothing answers HTTP 404, not 500.
  • AC-2: AppError::Invalid answers 400 and AppError::Upstream answers 502; every other error still answers 500.
  • AC-3: The KNOWN_OPEN e2e allowance for the 500-on-missing-note pattern is removed and the affected specs still pass.
  • Hand-editing generated.rs. It is generated; the fix belongs in the rust-ontogen emitter.
  • A broader HTTP status vocabulary beyond NotFound/Invalid/Upstream.
  • The fix lands in the external rust-ontogen repository first; this task cannot close by editing only this repo.
  • The upstream E0003 epic describes the same defect and owns the fix direction.

Found by the agent-pants bug survey, N-5LD4-bug-sweep-2026-09-12-agent-pants (rows AP-42, AP-43, AP-44). The page-side symptom — a route that addresses nothing should not even ask the API — was fixed separately; this task is the remaining backend half.


← Back to Tasks