{"record":{"id":"3ae80438ccf26732","repo":"wavetermdev/waveterm","slug":"error-getting-client-data-w","errorCode":null,"errorMessage":"error getting client data: %w","messagePattern":"error getting client data: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/service/clientservice/clientservice.go","lineNumber":57,"sourceCode":"\treturn tab, nil\n}\n\nfunc (cs *ClientService) GetAllConnStatus(ctx context.Context) ([]wshrpc.ConnStatus, error) {\n\tsshStatuses := conncontroller.GetAllConnStatus()\n\twslStatuses := wslconn.GetAllConnStatus()\n\treturn append(sshStatuses, wslStatuses...), nil\n}\n\n// moves the window to the front of the windowId stack\nfunc (cs *ClientService) FocusWindow(ctx context.Context, windowId string) error {\n\treturn wcore.FocusWindow(ctx, windowId)\n}\n\nfunc (cs *ClientService) AgreeTos(ctx context.Context) (waveobj.UpdatesRtnType, error) {\n\tctx = waveobj.ContextWithUpdates(ctx)\n\tclientData, err := wstore.DBGetSingleton[*waveobj.Client](ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting client data: %w\", err)\n\t}\n\ttimestamp := time.Now().UnixMilli()\n\tclientData.TosAgreed = timestamp\n\terr = wstore.DBUpdate(ctx, clientData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error updating client data: %w\", err)\n\t}\n\twcore.BootstrapStarterLayout(ctx)\n\treturn waveobj.ContextGetUpdatesRtn(ctx), nil\n}\n\nfunc (cs *ClientService) TelemetryUpdate(ctx context.Context, telemetryEnabled bool) error {\n\tmeta := waveobj.MetaMapType{\n\t\twconfig.ConfigKey_TelemetryEnabled: telemetryEnabled,\n\t}\n\terr := wconfig.SetBaseConfigValue(meta)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error setting telemetry value: %w\", err)","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/service/clientservice/clientservice.go#L39-L75","documentation":"AgreeTos wraps failures from wstore.DBGetSingleton[*waveobj.Client] with 'error getting client data: %w'. The Client record is a singleton in wstore; this error means the singleton read failed — typically the Client row is missing or the DB read errored. AgreeTos cannot proceed without loading the Client record.","triggerScenarios":"Calling ClientService.AgreeTos when the wstore has no Client singleton (fresh/corrupted DB) or the singleton read fails on I/O error.","commonSituations":"First-run with an uninitialized or partially migrated DB; manual deletion/corruption of the wstore file; running with a misconfigured WAVE_HOME pointing at an empty data dir.","solutions":["Check the wrapped error: 'key not found' means the Client singleton is missing — restart the app to re-run bootstrap","Ensure WAVE_HOME/data dir points at the real Wave Terminal data directory","If the DB is corrupted, restore/backup the wstore file and let the app recreate it"],"exampleFix":"// before\n_, err := cs.AgreeTos(ctx)\n// after\nif _, err := cs.AgreeTos(ctx); err != nil && strings.Contains(err.Error(), \"key not found\") {\n    // re-bootstrap client data, then retry\n    err = bootstrapClient(ctx)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"updates, err := cs.AgreeTos(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"key not found\") { /* re-bootstrap client data */ }\n    return err\n}","preventionTips":["Let the app bootstrap the Client singleton before calling AgreeTos","Do not point WAVE_HOME at an empty/custom dir unintentionally","Back up the wstore file before manual DB surgery"],"tags":["go","database","wstore","tos"],"backgroundTag":"record-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}