wavetermdev/waveterm · error
object not found: %s
Error message
object not found: %s
What it means
UpdateObject checks wstore.DBExistsORef before writing; if no object with the given ORef is stored it fails with 'object not found: <oref>'. UpdateObject only updates existing objects, it never creates them.
Source
Thrown at pkg/service/objectservice/objectservice.go:155
return tsgenmeta.MethodMeta{
ArgNames: []string{"uiContext", "waveObj", "returnUpdates"},
}
}
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
- Fetch the object fresh via wstore.DBGet* before updating so you know it exists.
- Use the create API if the object should be created rather than updated.
- Detect deletion (e.g. block closed) and skip or re-create instead of updating.
- Refresh client-side references from the backend to clear stale state.
Example fix
// before
wstore.DBUpdate(ctx, staleObj)
// after
existing, err := wstore.DBGetBlock(ctx, oid)
if err != nil {
return fmt.Errorf("block %s no longer exists, skipping update", oid)
}
existing.View = staleObj.View
wstore.DBUpdate(ctx, existing) Defensive patterns
Strategy: validation
Validate before calling
exists, err := wstore.DBExistsORef(ctx, waveobj.ORefFromWaveObj(obj))
if err != nil || !exists {
return fmt.Errorf("object %s does not exist; cannot update", oref)
} Try / catch
if _, err := svc.UpdateObject(uiCtx, obj, true); err != nil && strings.Contains(err.Error(), "object not found") {
// handle stale reference: refresh or re-create
} Prevention
- Re-fetch objects before mutating instead of caching long-lived references.
- Subscribe to object-deletion events and invalidate local caches.
- Use create APIs for new objects; update only known-existing ones.
When it happens
Trigger: Calling UpdateObject with a WaveObj whose OID was never persisted, or that was deleted (closed block, removed workspace) between fetch and update; passing a hand-constructed object with an invalid OID.
Common situations: Frontend holds a stale reference after the block was closed elsewhere; update races with object deletion; typos or truncated OIDs from external scripts.
Related errors
- update wavobj is nil
- unable to get layout state for given id %s: %w
- error listing workspaces: %w
- error getting workspace: %w
- call ${methodName} error: ${respData.error}
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/86553c112bf5fd62.
Report an issue: GitHub.