{"record":{"id":"7d664ec254ed250b","repo":"wavetermdev/waveterm","slug":"unable-to-queue-layout-actions-for-portable-layout","errorCode":null,"errorMessage":"unable to queue layout actions for portable layout: %w","messagePattern":"unable to queue layout actions for portable layout: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/layout.go","lineNumber":138,"sourceCode":"\t\tlayoutAction := layout[i]\n\n\t\tblockData, err := CreateBlockWithTelemetry(ctx, tabId, layoutAction.BlockDef, &waveobj.RuntimeOpts{}, recordTelemetry)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to create block to apply portable layout to tab %s: %w\", tabId, err)\n\t\t}\n\n\t\tactions[i+1] = waveobj.LayoutActionData{\n\t\t\tActionType: LayoutActionDataType_InsertAtIndex,\n\t\t\tBlockId:    blockData.OID,\n\t\t\tIndexArr:   &layoutAction.IndexArr,\n\t\t\tNodeSize:   layoutAction.Size,\n\t\t\tFocused:    layoutAction.Focused,\n\t\t}\n\t}\n\n\terr := QueueLayoutActionForTab(ctx, tabId, actions...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to queue layout actions for portable layout: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc BootstrapStarterLayout(ctx context.Context) error {\n\tctx, cancelFn := context.WithTimeout(ctx, 2*time.Second)\n\tdefer cancelFn()\n\tclient, err := wstore.DBGetSingleton[*waveobj.Client](ctx)\n\tif err != nil {\n\t\tlog.Printf(\"unable to find client: %v\\n\", err)\n\t\treturn fmt.Errorf(\"unable to find client: %w\", err)\n\t}\n\n\tif len(client.WindowIds) < 1 {\n\t\treturn fmt.Errorf(\"error bootstrapping layout, no windows exist\")\n\t}\n","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/layout.go#L120-L156","documentation":"After all blocks are created, ApplyPortableLayout queues the clear+insert action sequence via QueueLayoutActionForTab. This error wraps that failure — meaning blocks were created but the layout actions could not be persisted, usually because the tab's LayoutState could not be read or updated (errors 1300/1301 bubbled up wrapped).","triggerScenarios":"QueueLayoutActionForTab fails: tab not found (GetLayoutIdForTab), LayoutState missing, or DBUpdate write failure while persisting PendingBackendActions.","commonSituations":"Applying a layout to a tab deleted concurrently; DB write errors (disk full, permissions); calling with a tabId created outside normal CreateTab flow so LayoutState is unset.","solutions":["Inspect the wrapped error: if it mentions the tab/layout id, the tab or its LayoutState is missing; if it's a DB error, check storage","Re-fetch the tab and confirm Tab.LayoutState is non-empty before applying","Retry the ApplyPortableLayout call; note already-created blocks may remain and a re-run clears the tree first","Check disk space/permissions for the wstore data directory"],"exampleFix":"// before\nerr := wcore.ApplyPortableLayout(ctx, staleTabId, layout, false)\n// after\nif _, err := wcore.GetLayoutIdForTab(ctx, tabId); err != nil { return err }\nerr = wcore.ApplyPortableLayout(ctx, tabId, layout, false)","handlingStrategy":"try-catch","validationCode":"if _, err := wcore.GetLayoutIdForTab(ctx, tabId); err != nil {\n    return fmt.Errorf(\"tab %s has no layout state: %w\", tabId, err)\n}","typeGuard":null,"tryCatchPattern":"if err := wcore.ApplyPortableLayout(ctx, tabId, layout, false); err != nil {\n    if strings.Contains(err.Error(), \"unable to queue layout actions\") {\n        // tab/layoutstate missing or DB write failed; re-resolve tab and retry\n    }\n}","preventionTips":["Pre-check the tab and its LayoutState exist","Handle partial state: blocks may have been created even when queueing fails; re-running clears the tree first","Keep the wstore directory writable and monitored for disk space"],"tags":["waveterm","layout","wstore","action-queue"],"backgroundTag":"record-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}