Skip to content

Commit 02f9b49

Browse files
zhmiaoCopilot
andcommitted
fix(server): map SparrowEngineError::NvjpegUnavailable to 503 (Phase E regression)
Phase E commit 8788425 added SparrowEngineError::NvjpegUnavailable(String) to the shared sparrow-engine-types crate and emits it from sparrow-engine-gpu {yolo,classifier,tiled}.rs JpegDecoder::new paths. sparrow-engine-server's bongo_into_response() match in error.rs was missed in that change, so any sparrow-engine-dev build of sparrow-engine-server (CPU or GPU) fails: error[E0004]: non-exhaustive patterns: `&sparrow_engine::SparrowEngineError::NvjpegUnavailable(_)` not covered --> sparrow-engine-server/src/error.rs:98:32 The match is shared across flavors because the variant exists unconditionally in sparrow-engine-types (not behind cfg). CPU never emits it but still must handle it for type exhaustiveness. Mapping: 503 SERVICE_UNAVAILABLE + code 'NVJPEG_UNAVAILABLE' — analogous to existing EngineFreed -> SERVICE_UNAVAILABLE 'ENGINE_UNAVAILABLE' (line 101). Semantically the GPU resource (libnvjpeg.so.12) is required but unavailable; operator can recover by installing the runtime via SPARROW_ENGINE_NVJPEG_LIBRARY_PATH. Verification: - cargo check -p sparrow-engine-server --no-default-features --features cpu: PASS - ./scripts/test.sh -p sparrow-engine-server --lib --no-default-features --features cpu: 53/53 PASS Root cause discovered while rebuilding sparrow-engine images from sparrow-engine-dev HEAD for sparrow webapp pin sync (sparrow side: chore/sparrow-engine-sync-2026-05-27). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6d70288 commit 02f9b49

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • sparrow-engine/sparrow-engine-server/src

sparrow-engine/sparrow-engine-server/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ fn bongo_into_response(e: SparrowEngineError) -> Response {
134134
ImageDecode(_) => (StatusCode::UNPROCESSABLE_ENTITY, "IMAGE_DECODE_ERROR"),
135135
InvalidStride { .. } => (StatusCode::UNPROCESSABLE_ENTITY, "INVALID_IMAGE_INPUT"),
136136
ImageFileNotFound(_) => (StatusCode::NOT_FOUND, "IMAGE_NOT_FOUND"),
137+
// GPU resources
138+
NvjpegUnavailable(_) => (StatusCode::SERVICE_UNAVAILABLE, "NVJPEG_UNAVAILABLE"),
137139
// ORT / IO
138140
Ort(_) => (StatusCode::INTERNAL_SERVER_ERROR, "INFERENCE_ERROR"),
139141
Io(_) => (StatusCode::INTERNAL_SERVER_ERROR, "IO_ERROR"),

0 commit comments

Comments
 (0)