{"record":{"id":"98dc5f9876dddba9","repo":"wavetermdev/waveterm","slug":"error-updating-object-w","errorCode":null,"errorMessage":"error updating object: %w","messagePattern":"error updating object: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/service/objectservice/objectservice.go","lineNumber":159,"sourceCode":"\nfunc (svc *ObjectService) UpdateObject(uiContext waveobj.UIContext, waveObj waveobj.WaveObj, returnUpdates bool) (waveobj.UpdatesRtnType, error) {\n\tctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout)\n\tdefer cancelFn()\n\tctx = waveobj.ContextWithUpdates(ctx)\n\tif waveObj == nil {\n\t\treturn nil, fmt.Errorf(\"update wavobj is nil\")\n\t}\n\toref := waveobj.ORefFromWaveObj(waveObj)\n\tfound, err := wstore.DBExistsORef(ctx, *oref)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting object: %w\", err)\n\t}\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"object not found: %s\", oref)\n\t}\n\terr = wstore.DBUpdate(ctx, waveObj)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error updating object: %w\", err)\n\t}\n\tif (waveObj.GetOType() == waveobj.OType_Workspace) && (waveObj.(*waveobj.Workspace).Name != \"\") {\n\t\twps.Broker.Publish(wps.WaveEvent{\n\t\t\tEvent: wps.Event_WorkspaceUpdate})\n\t}\n\tif returnUpdates {\n\t\treturn waveobj.ContextGetUpdatesRtn(ctx), nil\n\t}\n\treturn nil, nil\n}\n","sourceCodeStart":141,"sourceCodeEnd":170,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/service/objectservice/objectservice.go#L141-L170","documentation":"Returned when the objects service fails to apply an update to a stored object, typically a persistence-layer or serialization failure. The underlying error is wrapped with %w for inspection by callers.","triggerScenarios":"DBUpdate fails due to serialization problems, DB lock contention, disk full, or an internal constraint while writing an existing object.","commonSituations":"Disk quota exceeded on the home volume; concurrent updates to the same object from multiple windows; schema change where the in-memory object no longer matches stored expectations.","solutions":["Inspect the wrapped cause to distinguish serialization vs storage failure.","Check free disk space and permissions on the wave data directory.","Re-fetch the object and retry to rule out transient lock contention.","Confirm the object serializes cleanly with the current schema; rebuild from a fresh fetch before mutating."],"exampleFix":"// before\n_, err := svc.UpdateObject(uiCtx, obj, true)\n// after\nif _, err := svc.UpdateObject(uiCtx, obj, true); err != nil {\n    return fmt.Errorf(\"persist failed: %v\", errors.Unwrap(err))\n}","handlingStrategy":"retry","validationCode":"if err := validateSerializable(obj); err != nil { return err }","typeGuard":null,"tryCatchPattern":"_, err := svc.UpdateObject(uiCtx, obj, true)\nif err != nil {\n    if isTransientDB(err) {\n        time.Sleep(100 * time.Millisecond)\n        return svc.UpdateObject(uiCtx, obj, true)\n    }\n    return fmt.Errorf(\"persist failed: %v\", errors.Unwrap(err))\n}","preventionTips":["Keep free disk space on the volume holding the wave data directory.","Serialize updates to the same object through a single writer/goroutine.","Test object marshal-ability before large batch updates."],"tags":["database","write-failure","wstore","wrapped-error"],"backgroundTag":"database-write-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}