{"record":{"id":"6000822c0194be3c","repo":"wavetermdev/waveterm","slug":"error-retrieving-workspacelist-w","errorCode":null,"errorMessage":"error retrieving workspaceList: %w","messagePattern":"error retrieving workspaceList: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/workspace.go","lineNumber":129,"sourceCode":"\tif updated {\n\t\twstore.DBUpdate(ctx, ws)\n\t}\n\treturn ws, updated, nil\n}\n\n// If force is true, it will delete even if workspace is named.\n// If workspace is empty, it will be deleted, even if it is named.\n// Returns true if workspace was deleted, false if it was not deleted.\nfunc DeleteWorkspace(ctx context.Context, workspaceId string, force bool) (bool, string, error) {\n\tlog.Printf(\"DeleteWorkspace %s\\n\", workspaceId)\n\tworkspace, err := wstore.DBMustGet[*waveobj.Workspace](ctx, workspaceId)\n\tif err != nil && wstore.ErrNotFound == err {\n\t\treturn true, \"\", fmt.Errorf(\"workspace already deleted %w\", err)\n\t}\n\t// @jalileh list needs to be saved early on i assume\n\tworkspaces, err := ListWorkspaces(ctx)\n\tif err != nil {\n\t\treturn false, \"\", fmt.Errorf(\"error retrieving workspaceList: %w\", err)\n\t}\n\n\tif workspace.Name != \"\" && workspace.Icon != \"\" && !force && len(workspace.TabIds) > 0 {\n\t\tlog.Printf(\"Ignoring DeleteWorkspace for workspace %s as it is named\\n\", workspaceId)\n\t\treturn false, \"\", nil\n\t}\n\n\tfor _, tabId := range workspace.TabIds {\n\t\tlog.Printf(\"deleting tab %s\\n\", tabId)\n\t\t_, err := DeleteTab(ctx, workspaceId, tabId, false)\n\t\tif err != nil {\n\t\t\treturn false, \"\", fmt.Errorf(\"error closing tab: %w\", err)\n\t\t}\n\t}\n\twindowId, _ := wstore.DBFindWindowForWorkspaceId(ctx, workspaceId)\n\terr = wstore.DBDelete(ctx, waveobj.OType_Workspace, workspaceId)\n\tif err != nil {\n\t\treturn false, \"\", fmt.Errorf(\"error deleting workspace: %w\", err)","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/workspace.go#L111-L147","documentation":"Returned when the workspace list cannot be retrieved from the workspace store. The underlying error is wrapped with %w.","triggerScenarios":"Calling DeleteWorkspace / SwitchWorkspace / CloseWindow while ListWorkspaces errors out (store read failure, corrupted workspaceList record).","commonSituations":"Corrupted wave store, locked DB from a second running instance, IO errors on the data directory.","solutions":["Inspect the wrapped cause for the storage read error","Check permissions/integrity of the Wave data directory","Close other Wave instances holding the DB, then retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := wcore.ListWorkspaces(ctx); err != nil {\n    return fmt.Errorf(\"store unavailable, cannot delete: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"deleted, _, err := wcore.DeleteWorkspace(ctx, wsId, force)\nif err != nil {\n    log.Printf(\"delete failed (store read): %v\", err)\n    return err\n}","preventionTips":["Verify the wave store is readable before workspace operations","Avoid multiple concurrent Wave instances on one data dir","Watch for disk I/O errors in system logs"],"tags":["go","database","workspace"],"backgroundTag":"database-read-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}