{"record":{"id":"99f901d1587e355e","repo":"wavetermdev/waveterm","slug":"error-getting-workspace-w-99f901","errorCode":null,"errorMessage":"error getting workspace: %w","messagePattern":"error getting workspace: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/layout.go","lineNumber":166,"sourceCode":"\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\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":148,"sourceCodeEnd":179,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/layout.go#L148-L179","documentation":"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.","triggerScenarios":"window.WorkspaceId points to a workspace record that was deleted or never created; wstore DB read error; context timeout (2s deadline in BootstrapStarterLayout).","commonSituations":"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.","solutions":["Inspect the wrapped error; if ErrNotFound, the workspace is dangling — recreate it or reset the store","Ensure window creation flow also creates and links its workspace before bootstrap","Check wave store DB integrity and backups","Consider whether a store migration/version change dropped workspace records"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"window, err := wstore.DBMustGet[*waveobj.Window](ctx, windowId)\nif err != nil { return err }\nif _, err := wstore.DBMustGet[*waveobj.Workspace](ctx, window.WorkspaceId); err != nil {\n    return fmt.Errorf(\"workspace %s missing: %w\", window.WorkspaceId, err)\n}","typeGuard":null,"tryCatchPattern":"if err := wcore.BootstrapStarterLayout(ctx); err != nil {\n    if strings.Contains(err.Error(), \"error getting workspace\") {\n        if errors.Is(err, wstore.ErrNotFound) {\n            // recreate workspace or reset the store\n        }\n    }\n}","preventionTips":["Ensure the window-creation flow persists its workspace atomically","Validate workspace references during any store migration","Maintain backups of the wave store DB"],"tags":["waveterm","wstore","workspace","dangling-reference"],"backgroundTag":"record-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}