{"record":{"id":"3fa6be6421a5bf9b","repo":"wavetermdev/waveterm","slug":"error-applying-starter-layout-w","errorCode":null,"errorMessage":"error applying starter layout: %w","messagePattern":"error applying starter layout: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/layout.go","lineNumber":174,"sourceCode":"\n\twindowId := client.WindowIds[0]\n\n\twindow, err := wstore.DBMustGet[*waveobj.Window](ctx, windowId)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting window: %w\", err)\n\t}\n\n\tworkspace, err := wstore.DBMustGet[*waveobj.Workspace](ctx, window.WorkspaceId)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting workspace: %w\", err)\n\t}\n\n\ttabId := workspace.ActiveTabId\n\n\tstarterLayout := GetStarterLayout()\n\terr = ApplyPortableLayout(ctx, tabId, starterLayout, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error applying starter layout: %w\", err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":156,"sourceCodeEnd":179,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/layout.go#L156-L179","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Unwrap the error chain: it will name either the block-creation step or the queue step","Verify workspace.ActiveTabId references an existing tab with a LayoutState","Check wstore disk space/permissions","Retry bootstrap after fixing the store; a re-run clears the tree first (ClearTree action)"],"exampleFix":"// before\ntabId := workspace.ActiveTabId // may be stale\n// after\nif _, err := wcore.GetLayoutIdForTab(ctx, workspace.ActiveTabId); err != nil {\n    return fmt.Errorf(\"active tab invalid: %w\", err)\n}\nerr = wcore.ApplyPortableLayout(ctx, workspace.ActiveTabId, wcore.GetStarterLayout(), false)","handlingStrategy":"try-catch","validationCode":"workspace, _ := wstore.DBMustGet[*waveobj.Workspace](ctx, window.WorkspaceId)\nif _, err := wcore.GetLayoutIdForTab(ctx, workspace.ActiveTabId); err != nil {\n    return fmt.Errorf(\"active tab %s invalid: %w\", workspace.ActiveTabId, err)\n}","typeGuard":null,"tryCatchPattern":"if err := wcore.BootstrapStarterLayout(ctx); err != nil {\n    if strings.Contains(err.Error(), \"error applying starter layout\") {\n        // unwrap: block creation vs action queue failure; fix store and retry\n    }\n}","preventionTips":["Verify workspace.ActiveTabId points to a live tab with a LayoutState","Retry is safe: ApplyPortableLayout clears the tree first","Check disk/permissions on first-run machines"],"tags":["waveterm","layout","bootstrap","starter-layout"],"backgroundTag":"record-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}