wavetermdev/waveterm · error
error getting object: %w
Error message
error getting object: %w
What it means
GetObject wraps failures from wstore.DBGetORef with 'error getting object: %w'. The oref parsed fine but no object of the given type/oid exists in wstore (or the DB read failed). Most commonly the wrapped error is a 'key not found' from the store.
Source
Thrown at pkg/service/objectservice/objectservice.go:48
}
func (svc *ObjectService) GetObject_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
Desc: "get wave object by oref",
ArgNames: []string{"oref"},
}
}
func (svc *ObjectService) GetObject(orefStr string) (waveobj.WaveObj, error) {
oref, err := parseORef(orefStr)
if err != nil {
return nil, err
}
ctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout)
defer cancelFn()
obj, err := wstore.DBGetORef(ctx, *oref)
if err != nil {
return nil, fmt.Errorf("error getting object: %w", err)
}
return obj, nil
}
func (svc *ObjectService) GetObjects_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
ArgNames: []string{"orefs"},
ReturnDesc: "objects",
}
}
func (svc *ObjectService) GetObjects(orefStrArr []string) ([]waveobj.WaveObj, error) {
ctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout)
defer cancelFn()
var orefArr []waveobj.ORef
for _, orefStr := range orefStrArr {
orefObj, err := parseORef(orefStr)View on GitHub (pinned to a4447c1563)
Solutions
- Check the wrapped error: 'key not found' means the object is gone — refresh from the live object list
- Verify the OType prefix matches the actual object type stored
- Re-resolve the OID from the current tab/window state instead of a cached value
Example fix
// before
obj, err := svc.GetObject(ctx, cachedOref)
// after
if _, err := svc.GetObject(ctx, cachedOref); err != nil && strings.Contains(err.Error(), "key not found") {
cachedOref = resolveCurrentOref(ctx) // refresh from live state
} Defensive patterns
Strategy: try-catch
Validate before calling
if !strings.Contains(orefStr, ":") { return fmt.Errorf("malformed oref") } Try / catch
obj, err := svc.GetObject(ctx, orefStr)
if err != nil {
if strings.Contains(err.Error(), "key not found") { /* stale ref; refresh */ }
return err
} Prevention
- Re-resolve orefs from live state after tabs/blocks close
- Verify the OType prefix matches the object you expect
- Avoid caching orefs across app restarts
When it happens
Trigger: Calling ObjectService.GetObject with an oref whose OID was deleted (closed block/tab), whose type prefix is wrong for the stored object, or on DB read failure.
Common situations: Referencing a block after the tab containing it was closed; stale orefs cached in the frontend across restarts; mixing up block vs. tab OTypes.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- error getting tab: %w
- error getting client data: %w
- error updating %q meta: %w
- error getting client: %v
- failed to get job: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/7203562f4e2970b2.
Report an issue: GitHub.