wavetermdev/waveterm · error
error getting window: %w
Error message
error getting window: %w
What it means
After selecting the first window id from the client, BootstrapStarterLayout does DBMustGet[*waveobj.Window]. This error wraps any failure — most commonly the window record missing from the store despite its id being referenced in client.WindowIds.
Source
Thrown at pkg/wcore/layout.go:161
func BootstrapStarterLayout(ctx context.Context) error {
ctx, cancelFn := context.WithTimeout(ctx, 2*time.Second)
defer cancelFn()
client, err := wstore.DBGetSingleton[*waveobj.Client](ctx)
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
- Inspect the wrapped error: ErrNotFound means a dangling WindowIds entry — remove it or recreate the window
- Re-verify window creation completed and persisted before bootstrapping
- Check wave store integrity; restore or delete the corrupted DB so startup re-initializes
- Watch for the 2s ctx timeout on slow filesystems
Defensive patterns
Strategy: validation
Validate before calling
for _, wid := range client.WindowIds {
if _, err := wstore.DBGet[*waveobj.Window](ctx, wid); err != nil {
// dangling window reference — prune or recreate before bootstrap
}
} Try / catch
if err := wcore.BootstrapStarterLayout(ctx); err != nil {
if strings.Contains(err.Error(), "error getting window") {
if errors.Is(err, wstore.ErrNotFound) {
// remove stale WindowIds entry and recreate window
}
}
} Prevention
- Treat WindowIds as soft references; validate before use
- Avoid manual edits to the wave store DB
- Watch the 2s context deadline on slow filesystems
When it happens
Trigger: client.WindowIds[0] refers to a window id whose record was deleted, was never persisted, or the wstore read fails; also fires on the 2s context timeout of BootstrapStarterLayout.
Common situations: Stale window id left in the client record after a crash or manual DB edit; partial startup where window creation failed after the client was updated; corrupted wave store.
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 workspace: %w
- unable to get layout state for given id %s: %w
- unable to update layout state with new actions: %w
- unable to queue layout actions for portable layout: %w
- unable to find client: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/9fac557f4e2e3c00.
Report an issue: GitHub.