wavetermdev/waveterm · error

error applying starter layout: %w

Error message

error applying starter layout: %w

What it means

Final step of BootstrapStarterLayout: apply GetStarterLayout() to the workspace's ActiveTabId. This error wraps any failure from ApplyPortableLayout — block creation failures (1302) or action-queueing failures (1303) bubbled up wrapped.

Source

Thrown at pkg/wcore/layout.go:174

	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. Unwrap the error chain: it will name either the block-creation step or the queue step
  2. Verify workspace.ActiveTabId references an existing tab with a LayoutState
  3. Check wstore disk space/permissions
  4. Retry bootstrap after fixing the store; a re-run clears the tree first (ClearTree action)

Example fix

// before
tabId := workspace.ActiveTabId // may be stale
// after
if _, err := wcore.GetLayoutIdForTab(ctx, workspace.ActiveTabId); err != nil {
    return fmt.Errorf("active tab invalid: %w", err)
}
err = wcore.ApplyPortableLayout(ctx, workspace.ActiveTabId, wcore.GetStarterLayout(), false)
Defensive patterns

Strategy: try-catch

Validate before calling

workspace, _ := wstore.DBMustGet[*waveobj.Workspace](ctx, window.WorkspaceId)
if _, err := wcore.GetLayoutIdForTab(ctx, workspace.ActiveTabId); err != nil {
    return fmt.Errorf("active tab %s invalid: %w", workspace.ActiveTabId, err)
}

Try / catch

if err := wcore.BootstrapStarterLayout(ctx); err != nil {
    if strings.Contains(err.Error(), "error applying starter layout") {
        // unwrap: block creation vs action queue failure; fix store and retry
    }
}

Prevention

When it happens

Trigger: ApplyPortableLayout fails for the active tab: invalid blockdef in the starter layout (unexpected with the built-in layout), missing tab for workspace.ActiveTabId, or DB failure queueing the actions.

Common situations: workspace.ActiveTabId dangling (tab deleted); DB write errors during startup; first-run on a machine with disk/permission problems; calling AgreeTos when the store is in a partially initialized state.

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/3fa6be6421a5bf9b. Report an issue: GitHub.