wavetermdev/waveterm · error
marshaling json: %w
Error message
marshaling json: %w
What it means
With --json, `wsh jobdebug list` marshals the job list with json.MarshalIndent and wraps any marshal failure as 'marshaling json' (cmd/wshcmd-jobdebug.go:182). json.Marshal only errors on unsupported types (channels, funcs, cycles), so this indicates a bug or unexpected value in the server-returned job data rather than a user mistake.
Source
Thrown at cmd/wsh/cmd/wshcmd-jobdebug.go:182
rtnData, err := wshclient.JobControllerListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 5000})
if err != nil {
return fmt.Errorf("getting job debug list: %w", err)
}
connectedJobIds, err := wshclient.JobControllerConnectedJobsCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 5000})
if err != nil {
return fmt.Errorf("getting connected job ids: %w", err)
}
connectedMap := make(map[string]bool)
for _, jobId := range connectedJobIds {
connectedMap[jobId] = true
}
if jobDebugJsonFlag {
jsonData, err := json.MarshalIndent(rtnData, "", " ")
if err != nil {
return fmt.Errorf("marshaling json: %w", err)
}
fmt.Printf("%s\n", string(jsonData))
return nil
}
fmt.Printf("%-36s %-25s %-9s %-10s %-6s %-30s %-8s %-10s %-8s\n", "OID", "Connection", "Connected", "Manager", "Reason", "Cmd", "ExitCode", "Stream", "Attached")
for _, job := range rtnData {
connectedStatus := "no"
if connectedMap[job.OID] {
connectedStatus = "yes"
}
if job.TerminateOnReconnect {
connectedStatus += "*"
}
streamStatus := "-"
if job.StreamDone {
if job.StreamError == "" {View on GitHub (pinned to a4447c1563)
Solutions
- Retry without --json; the table output path does not marshal JSON
- Update Wave Terminal/wsh to a version where the job data struct marshals cleanly
- Report the wrapped inner error to the Wave maintainers if it persists — it indicates a serialization bug
Defensive patterns
Strategy: fallback
Validate before calling
wsh jobdebug list >/dev/null 2>&1 || exit 1 # data available; json path is a bug if it fails
Try / catch
wsh jobdebug list --json || wsh jobdebug list # fall back to table output
Prevention
- Prefer the table output unless JSON is essential
- Keep wsh and the app on matching versions
- Report persistent --json failures with the wrapped inner error — it indicates a serialization bug
When it happens
Trigger: Running `wsh jobdebug list --json` when the JobControllerList payload contains a value encoding/json cannot represent (unsupported type or reference cycle).
Common situations: Practically rare for users; most likely encountered after a Wave version change introduced a new field of an unsupported type in the job info struct.
Related errors
- marshaling directory listing for %s: %w
- failed to marshal JSON: %v
- getting job debug list: %w
- getting connected job ids: %w
- deleting job: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/c54d11d7c80fc758.
Report an issue: GitHub.