{"record":{"id":"e5720f793347efaa","repo":"henrygd/beszel","slug":"resp-error","errorCode":null,"errorMessage":"${resp.Error}","messagePattern":"\\$\\{resp\\.Error\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hub/transport/ssh.go","lineNumber":112,"sourceCode":"\tif err := session.Shell(); err != nil {\n\t\treturn err\n\t}\n\n\t// Send request\n\thubReq := common.HubRequest[any]{Action: action, Data: req}\n\tif err := cbor.NewEncoder(stdin).Encode(hubReq); err != nil {\n\t\treturn fmt.Errorf(\"failed to encode request: %w\", err)\n\t}\n\tstdin.Close()\n\n\t// Read response\n\tvar resp common.AgentResponse\n\tif err := cbor.NewDecoder(stdout).Decode(&resp); err != nil {\n\t\treturn fmt.Errorf(\"failed to decode response: %w\", err)\n\t}\n\n\tif resp.Error != \"\" {\n\t\treturn errors.New(resp.Error)\n\t}\n\n\tif err := session.Wait(); err != nil {\n\t\treturn err\n\t}\n\n\treturn UnmarshalResponse(resp, action, dest)\n}\n\n// IsConnected returns true if the SSH connection is active.\nfunc (t *SSHTransport) IsConnected() bool {\n\treturn t.client != nil\n}\n\n// Close terminates the SSH connection.\nfunc (t *SSHTransport) Close() {\n\tif t.client != nil {\n\t\tt.client.Close()","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/henrygd/beszel/blob/b38fb7dafa60812cc22e6a84ce313e94f1ce0a32/internal/hub/transport/ssh.go#L94-L130","documentation":"The SSH agent executed the request and returned an AgentResponse whose Error field is non-empty; Request forwards it verbatim (errors.New(resp.Error)). The message text is whatever the agent reported, so it varies per failure.","triggerScenarios":"Any SSH Request (via RequestWithRetry) where the remote agent processes the command but reports an error in resp.Error — e.g. agent-side command failure, unreadable data, unsupported request.","commonSituations":"Agent and hub version mismatch causing unsupported requests; the agent failing to collect stats (permissions, missing /proc entries); corrupted or stale agent installation on the host.","solutions":["Read resp.Error text in the returned error to see the agent's actual complaint","Update the agent on the remote host to match the hub version","SSH into the host and run the beszel agent manually to reproduce the error","Check the agent's logs on the remote machine","Retry the request; transient collection errors may resolve"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check: ensure agent is reachable and version-compatible\nversion, err := client.Request(common.GetVersion, new(string))\nif err != nil { /* agent reporting errors or incompatible */ }","typeGuard":null,"tryCatchPattern":"data, err := client.RequestWithRetry(common.GetData, dest)\nif err != nil {\n    log.Printf(\"agent error from %s: %v\", host, err) // message is the agent's own text\n    return err\n}","preventionTips":["Keep agent and hub versions in sync","Monitor agent logs on remote hosts","Pin agent deployments to your hub's supported version range"],"tags":["go","ssh","agent","remote-error"],"backgroundTag":"agent-returned-error","analyzedSha":"b38fb7dafa60812cc22e6a84ce313e94f1ce0a32","analyzedAt":"2026-08-31T15:10:10.149Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}