Skip to content

zoo api discards the server error body and duplicates the reason phrase ("404 Not Found Not Found") #1754

Description

@sneg55

zoo api discards the server error body and duplicates the reason phrase (e.g. "404 Not Found Not Found")

Context: API Makeathon participant. Found while reviewing the raw api command's error path.

On a non-success status, zoo api returns without reading the response body, and formats both status and status.canonical_reason(), although the status display already includes the reason phrase (src/cmd_api.rs:172-193). The actionable JSON or text error the server sent is lost, and the generic status text is repeated. A checked-in test codifies the 404 Not Found Not Found output (src/tests.rs:587-594).

Concrete failure

A validation or authorization failure appears as 404 Not Found Not Found (or similar) with no server explanation. The user loses the request id, the error code, and the human-readable message that would tell them what went wrong.

Verify

Return a non-success response containing a distinctive JSON sentinel in the body. Current stderr omits the sentinel and repeats the reason phrase.

Suggested fix

Read and surface the response body on error, and format the status once (drop the redundant canonical_reason()).

Environment

Zoo CLI v0.2.184 (33534cd). Reviewed against the current main of KittyCAD/cli.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions