Skip to content

Agent-mode classifies client-side decode errors as connection_error #28

Description

@Kevin-Chant

Bug

When a server response fails to decode (schema drift), the agent-mode structured error reports "error_type": "connection_error" with hints like "Check network connectivity" — misleading, since the HTTP request actually succeeded and the network is fine. It's a client-side deserialization failure.

Root cause (Speakeasy)

The generated classifyErrorType(statusCode) maps statusCode == 0connection_error. A client-side JSON decode error carries no HTTP status (0), so it's lumped in with genuine connection failures.

Stopgap fix (retire when upstream is fixed)

.speakeasy/patches/internal/output/agentmode.go.patch: classifyErrorType now also takes the error; when statusCode == 0 and the error is (or wraps) a *json.UnmarshalTypeError / *json.SyntaxError, it returns response_error with an actionable hint ("the response didn't match the expected schema; retry with -o json").

To retire: once the generated agent-mode classifier distinguishes response-decode/parse errors from connection errors, drop that hunk.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcustomA custom version was applied

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions