growthbook / growthbook/cli

Agent-mode classifies client-side decode errors as connection_error

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
bug custom
Dominant language
Go
Stars
1
Forks
0
Avg merge
1d 5h
Merged PRs (30d)
18

Description

## 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

- Introduced by #23
- Related: the `settings get` / `updateSchedule.hours` decode bug is the trigger that surfaced this.
- Upstream: file to speakeasy-api/speakeasy (generated agent-mode error classification).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with .speakeasy/patches/internal/output/agentmode.go.patch and inspect the generated classifyErrorType implementation it changes. Reproduce the settings get or updateSchedule.hours decode failure if possible, then verify that schema and JSON parse errors are reported as response_error with the actionable hint rather than connection_error; retire the hunk if the upstream classifier already handles this.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.