wavetermdev/waveterm · error

error getting tab: %w

Error message

error getting tab: %w

What it means

GetTabCommand looks up a *waveobj.Tab by id via wstore.DBGet. Any store-level failure (decode error, DB error) is wrapped as "error getting tab". Note that a simple missing tab id may surface here as a store error depending on wstore behavior.

Source

Thrown at pkg/wshrpc/wshserver/wshserver.go:1466

			return path, fmt.Errorf("error opening path: %w", err)
		}
	}
	return path, nil
}

func (ws *WshServer) FetchSuggestionsCommand(ctx context.Context, data wshrpc.FetchSuggestionsData) (*wshrpc.FetchSuggestionsResponse, error) {
	return suggestion.FetchSuggestions(ctx, data)
}

func (ws *WshServer) DisposeSuggestionsCommand(ctx context.Context, widgetId string) error {
	suggestion.DisposeSuggestions(ctx, widgetId)
	return nil
}

func (ws *WshServer) GetTabCommand(ctx context.Context, tabId string) (*waveobj.Tab, error) {
	tab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)
	if err != nil {
		return nil, fmt.Errorf("error getting tab: %w", err)
	}
	return tab, nil
}

func (ws *WshServer) GetAllBadgesCommand(ctx context.Context) ([]baseds.BadgeEvent, error) {
	return wcore.GetAllBadges(), nil
}

func (ws *WshServer) GetSecretsCommand(ctx context.Context, names []string) (map[string]string, error) {
	result := make(map[string]string)
	for _, name := range names {
		value, exists, err := secretstore.GetSecret(name)
		if err != nil {
			return nil, fmt.Errorf("error getting secret %q: %w", name, err)
		}
		if exists {
			result[name] = value
		}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Verify the tabId with GetAllTabsCommand or list the current tabs and use a fresh id.
  2. Check the wrapped cause to distinguish 'not found' from DB/decode errors.
  3. If the wave DB is implicated, inspect the data dir store; restarting Wave may reload a healthy store.

Example fix

// before
tab, err := wshclient.GetTabCommand(ctx, cachedTabId)
// after
tabs, _ := wshclient.GetAllTabsCommand(ctx)
if len(tabs) > 0 {
    tab, err = wshclient.GetTabCommand(ctx, tabs[0].Oid)
}
Defensive patterns

Strategy: validation

Validate before calling

tabs, err := wshclient.GetAllTabsCommand(ctx)
if err != nil {
    return err
}
found := false
for _, t := range tabs.Tabs {
    if string(t.Oid) == tabId {
        found = true
        break
    }
}
if !found {
    return fmt.Errorf("tab %s does not exist", tabId)
}

Try / catch

tab, err := wshclient.GetTabCommand(ctx, tabId)
if err != nil && strings.Contains(err.Error(), "error getting tab") {
    // refresh tab list and retry with a current id
}

Prevention

When it happens

Trigger: Calling GetTabCommand (wsh `gettab`) with a tabId not present in the wave store, a malformed OID, or when the underlying wstore DB read/decode fails.

Common situations: Automation scripts holding a tabId after the tab/window was closed; cross-connection usage where the tab id belongs to a different Wave instance; corrupted local wave DB.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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