{"record":{"id":"8a4404d155815e6b","repo":"wavetermdev/waveterm","slug":"error-setting-telemetry-value-w","errorCode":null,"errorMessage":"error setting telemetry value: %w","messagePattern":"error setting telemetry value: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/service/clientservice/clientservice.go","lineNumber":75,"sourceCode":"\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)\n\t}\n\treturn nil\n}\n","sourceCodeStart":57,"sourceCodeEnd":79,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/service/clientservice/clientservice.go#L57-L79","documentation":"TelemetryUpdate wraps failures from wconfig.SetBaseConfigValue with 'error setting telemetry value: %w'. It writes telemetryEnabled into the base config via MetaMapType; a failure means the config system rejected or failed to persist the value — usually settings file parse/permission problems.","triggerScenarios":"Calling TelemetryUpdate when the settings JSON file is malformed, read-only, or wconfig validation rejects the key/value.","commonSituations":"User hand-edited settings.json producing invalid JSON; settings file owned by root; schema version mismatch after an app upgrade.","solutions":["Validate the settings JSON file (fix syntax errors) in the Wave config directory","Fix write permissions on the settings file/directory","Back up and reset settings.json, then retry"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"var cfg map[string]any\nif err := json.Unmarshal(settingsJSON, &cfg); err != nil { return fmt.Errorf(\"settings JSON invalid\") }","typeGuard":null,"tryCatchPattern":"err := cs.TelemetryUpdate(ctx, enabled)\nif err != nil {\n    // inspect wrapped wconfig error; fix settings file, then retry once\n    return fmt.Errorf(\"telemetry not updated: %w\", err)\n}","preventionTips":["Never hand-edit settings.json without validating JSON afterwards","Keep the config directory writable by the running user","After upgrades, re-validate settings against the current schema"],"tags":["go","config","telemetry","settings"],"backgroundTag":"config-write-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}