{"record":{"id":"e5a73379e6dc1c72","repo":"wavetermdev/waveterm","slug":"error-getting-tab-w-e5a733","errorCode":null,"errorMessage":"error getting tab: %w","messagePattern":"error getting tab: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/wcore.go","lineNumber":136,"sourceCode":"\t\tEvent:  wps.Event_WaveObjUpdate,\n\t\tScopes: []string{oref.String()},\n\t\tData: waveobj.WaveObjUpdate{\n\t\t\tUpdateType: waveobj.UpdateType_Update,\n\t\t\tOType:      waveObj.GetOType(),\n\t\t\tOID:        waveobj.GetOID(waveObj),\n\t\t\tObj:        waveObj,\n\t\t},\n\t})\n}\n\nfunc ResolveBlockIdFromPrefix(ctx context.Context, tabId string, blockIdPrefix string) (string, error) {\n\tif len(blockIdPrefix) != 8 {\n\t\treturn \"\", fmt.Errorf(\"widget_id must be 8 characters\")\n\t}\n\n\ttab, err := wstore.DBMustGet[*waveobj.Tab](ctx, tabId)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting tab: %w\", err)\n\t}\n\n\tfor _, blockId := range tab.BlockIds {\n\t\tif strings.HasPrefix(blockId, blockIdPrefix) {\n\t\t\treturn blockId, nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"widget_id not found: %q\", blockIdPrefix)\n}\n\nfunc GoSendNoTelemetryUpdate(telemetryEnabled bool) {\n\tgo func() {\n\t\tdefer func() {\n\t\t\tpanichandler.PanicHandler(\"GoSendNoTelemetryUpdate\", recover())\n\t\t}()\n\t\tctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)\n\t\tdefer cancelFn()","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/wcore.go#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"Resolving a block prefix in a tab that was already closed; stale tabId cached by a caller; DB corruption or mid-shutdown access.","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"],"exampleFix":"// before\nblockId, err := wcore.ResolveBlockIdFromPrefix(ctx, staleTabId, prefix)\n// after\ntab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)\nif err == nil {\n    blockId, err = wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)\n}","handlingStrategy":"try-catch","validationCode":"tab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)\nif err != nil { return fmt.Errorf(\"tab %s unavailable: %w\", tabId, err) }","typeGuard":null,"tryCatchPattern":"blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)\nif errors.Is(err, wstore.ErrNotFound) {\n    return fmt.Errorf(\"tab %s no longer exists\", tabId)\n}","preventionTips":["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"],"tags":["database","tab","not-found"],"backgroundTag":"record-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}