wavetermdev/waveterm · error

error getting workspace: %w

Error message

error getting workspace: %w

What it means

BootstrapStarterLayout then loads the window's workspace via DBMustGet[*waveobj.Workspace]. This error wraps a failed read of window.WorkspaceId — typically a dangling workspace reference or a store read failure.

Source

Thrown at pkg/wcore/layout.go:166

	if err != nil {
		log.Printf("unable to find client: %v\n", err)
		return fmt.Errorf("unable to find client: %w", err)
	}

	if len(client.WindowIds) < 1 {
		return fmt.Errorf("error bootstrapping layout, no windows exist")
	}

	windowId := client.WindowIds[0]

	window, err := wstore.DBMustGet[*waveobj.Window](ctx, windowId)
	if err != nil {
		return fmt.Errorf("error getting window: %w", err)
	}

	workspace, err := wstore.DBMustGet[*waveobj.Workspace](ctx, window.WorkspaceId)
	if err != nil {
		return fmt.Errorf("error getting workspace: %w", err)
	}

	tabId := workspace.ActiveTabId

	starterLayout := GetStarterLayout()
	err = ApplyPortableLayout(ctx, tabId, starterLayout, false)
	if err != nil {
		return fmt.Errorf("error applying starter layout: %w", err)
	}

	return nil
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Inspect the wrapped error; if ErrNotFound, the workspace is dangling — recreate it or reset the store
  2. Ensure window creation flow also creates and links its workspace before bootstrap
  3. Check wave store DB integrity and backups
  4. Consider whether a store migration/version change dropped workspace records
Defensive patterns

Strategy: validation

Validate before calling

window, err := wstore.DBMustGet[*waveobj.Window](ctx, windowId)
if err != nil { return err }
if _, err := wstore.DBMustGet[*waveobj.Workspace](ctx, window.WorkspaceId); err != nil {
    return fmt.Errorf("workspace %s missing: %w", window.WorkspaceId, err)
}

Try / catch

if err := wcore.BootstrapStarterLayout(ctx); err != nil {
    if strings.Contains(err.Error(), "error getting workspace") {
        if errors.Is(err, wstore.ErrNotFound) {
            // recreate workspace or reset the store
        }
    }
}

Prevention

When it happens

Trigger: window.WorkspaceId points to a workspace record that was deleted or never created; wstore DB read error; context timeout (2s deadline in BootstrapStarterLayout).

Common situations: Wave store edited/degraded so workspace records are missing while windows remain; crash between window creation and workspace persistence; version migration that dropped old workspace records.

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


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