wavetermdev/waveterm · error

error updating object: %w

Error message

error updating object: %w

What it means

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.

Source

Thrown at pkg/service/objectservice/objectservice.go:159

func (svc *ObjectService) UpdateObject(uiContext waveobj.UIContext, waveObj waveobj.WaveObj, returnUpdates bool) (waveobj.UpdatesRtnType, error) {
	ctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout)
	defer cancelFn()
	ctx = waveobj.ContextWithUpdates(ctx)
	if waveObj == nil {
		return nil, fmt.Errorf("update wavobj is nil")
	}
	oref := waveobj.ORefFromWaveObj(waveObj)
	found, err := wstore.DBExistsORef(ctx, *oref)
	if err != nil {
		return nil, fmt.Errorf("error getting object: %w", err)
	}
	if !found {
		return nil, fmt.Errorf("object not found: %s", oref)
	}
	err = wstore.DBUpdate(ctx, waveObj)
	if err != nil {
		return nil, fmt.Errorf("error updating object: %w", err)
	}
	if (waveObj.GetOType() == waveobj.OType_Workspace) && (waveObj.(*waveobj.Workspace).Name != "") {
		wps.Broker.Publish(wps.WaveEvent{
			Event: wps.Event_WorkspaceUpdate})
	}
	if returnUpdates {
		return waveobj.ContextGetUpdatesRtn(ctx), nil
	}
	return nil, nil
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Inspect the wrapped cause to distinguish serialization vs storage failure.
  2. Check free disk space and permissions on the wave data directory.
  3. Re-fetch the object and retry to rule out transient lock contention.
  4. Confirm the object serializes cleanly with the current schema; rebuild from a fresh fetch before mutating.

Example fix

// before
_, err := svc.UpdateObject(uiCtx, obj, true)
// after
if _, err := svc.UpdateObject(uiCtx, obj, true); err != nil {
    return fmt.Errorf("persist failed: %v", errors.Unwrap(err))
}
Defensive patterns

Strategy: retry

Validate before calling

if err := validateSerializable(obj); err != nil { return err }

Try / catch

_, err := svc.UpdateObject(uiCtx, obj, true)
if err != nil {
    if isTransientDB(err) {
        time.Sleep(100 * time.Millisecond)
        return svc.UpdateObject(uiCtx, obj, true)
    }
    return fmt.Errorf("persist failed: %v", errors.Unwrap(err))
}

Prevention

When it happens

Trigger: DBUpdate fails due to serialization problems, DB lock contention, disk full, or an internal constraint while writing an existing object.

Common situations: 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.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/98dc5f9876dddba9. Report an issue: GitHub.