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 == 0 → connection_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
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)mapsstatusCode == 0→connection_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:classifyErrorTypenow also takes the error; whenstatusCode == 0and the error is (or wraps) a*json.UnmarshalTypeError/*json.SyntaxError, it returnsresponse_errorwith 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
settings get/updateSchedule.hoursdecode bug is the trigger that surfaced this.