wavetermdev/waveterm · error
error getting tab: %w
Error message
error getting tab: %w
What it means
Returned when the referenced tab cannot be retrieved, e.g. it does not exist or the store lookup failed. The underlying error is wrapped with %w.
Source
Thrown at pkg/wcore/wcore.go:136
Event: wps.Event_WaveObjUpdate,
Scopes: []string{oref.String()},
Data: waveobj.WaveObjUpdate{
UpdateType: waveobj.UpdateType_Update,
OType: waveObj.GetOType(),
OID: waveobj.GetOID(waveObj),
Obj: waveObj,
},
})
}
func ResolveBlockIdFromPrefix(ctx context.Context, tabId string, blockIdPrefix string) (string, error) {
if len(blockIdPrefix) != 8 {
return "", fmt.Errorf("widget_id must be 8 characters")
}
tab, err := wstore.DBMustGet[*waveobj.Tab](ctx, tabId)
if err != nil {
return "", fmt.Errorf("error getting tab: %w", err)
}
for _, blockId := range tab.BlockIds {
if strings.HasPrefix(blockId, blockIdPrefix) {
return blockId, nil
}
}
return "", fmt.Errorf("widget_id not found: %q", blockIdPrefix)
}
func GoSendNoTelemetryUpdate(telemetryEnabled bool) {
go func() {
defer func() {
panichandler.PanicHandler("GoSendNoTelemetryUpdate", recover())
}()
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()View on GitHub (pinned to a4447c1563)
Solutions
- Verify tabId is a valid, currently open tab
- Handle wstore.ErrNotFound from the wrapped error — the tab was closed/removed
- Refresh the tab list (wstore.DBGet[*waveobj.Tab]) before resolving
- Check DB health if ErrNotFound is not the wrapped cause
Example fix
// before
blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, staleTabId, prefix)
// after
tab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)
if err == nil {
blockId, err = wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)
} Defensive patterns
Strategy: try-catch
Validate before calling
tab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)
if err != nil { return fmt.Errorf("tab %s unavailable: %w", tabId, err) } Try / catch
blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)
if errors.Is(err, wstore.ErrNotFound) {
return fmt.Errorf("tab %s no longer exists", tabId)
} Prevention
- Confirm the tab is open before resolving blocks
- Refresh tab state instead of caching tabIds
- Handle tab-closed races in async tool handlers
- Skip resolution during app shutdown
When it happens
Trigger: wstore.DBMustGet returns an error — most commonly the tabId does not exist (ErrNotFound), or the DB read fails. Tab may have been closed while resolution was in flight.
Common situations: Resolving a block prefix in a tab that was already closed; stale tabId cached by a caller; DB corruption or mid-shutdown access.
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 block: %w
- error getting tab: %w
- error getting window: %w
- error getting workspace: %w
- error getting tab: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/e5a73379e6dc1c72.
Report an issue: GitHub.