{"record":{"id":"c54d11d7c80fc758","repo":"wavetermdev/waveterm","slug":"marshaling-json-w","errorCode":null,"errorMessage":"marshaling json: %w","messagePattern":"marshaling json: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-jobdebug.go","lineNumber":182,"sourceCode":"\trtnData, err := wshclient.JobControllerListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 5000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting job debug list: %w\", err)\n\t}\n\n\tconnectedJobIds, err := wshclient.JobControllerConnectedJobsCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 5000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting connected job ids: %w\", err)\n\t}\n\n\tconnectedMap := make(map[string]bool)\n\tfor _, jobId := range connectedJobIds {\n\t\tconnectedMap[jobId] = true\n\t}\n\n\tif jobDebugJsonFlag {\n\t\tjsonData, err := json.MarshalIndent(rtnData, \"\", \"  \")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"marshaling json: %w\", err)\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", string(jsonData))\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"%-36s %-25s %-9s %-10s %-6s %-30s %-8s %-10s %-8s\\n\", \"OID\", \"Connection\", \"Connected\", \"Manager\", \"Reason\", \"Cmd\", \"ExitCode\", \"Stream\", \"Attached\")\n\tfor _, job := range rtnData {\n\t\tconnectedStatus := \"no\"\n\t\tif connectedMap[job.OID] {\n\t\t\tconnectedStatus = \"yes\"\n\t\t}\n\t\tif job.TerminateOnReconnect {\n\t\t\tconnectedStatus += \"*\"\n\t\t}\n\n\t\tstreamStatus := \"-\"\n\t\tif job.StreamDone {\n\t\t\tif job.StreamError == \"\" {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-jobdebug.go#L164-L200","documentation":"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.","triggerScenarios":"Running `wsh jobdebug list --json` when the JobControllerList payload contains a value encoding/json cannot represent (unsupported type or reference cycle).","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"wsh jobdebug list >/dev/null 2>&1 || exit 1  # data available; json path is a bug if it fails","typeGuard":null,"tryCatchPattern":"wsh jobdebug list --json || wsh jobdebug list   # fall back to table output","preventionTips":["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"],"tags":["json","serialization","jobs","wsh"],"backgroundTag":"json-marshaling-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}