{"record":{"id":"b43d31065fc4207c","repo":"wavetermdev/waveterm","slug":"workspace-s-not-found-w","errorCode":null,"errorMessage":"workspace %s not found: %w","messagePattern":"workspace (.+?) not found: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/workspace.go","lineNumber":83,"sourceCode":"\t_, err = CreateTab(ctx, ws.OID, \"\", true, isInitialLaunch)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating tab: %w\", err)\n\t}\n\n\twps.Broker.Publish(wps.WaveEvent{\n\t\tEvent: wps.Event_WorkspaceUpdate,\n\t})\n\n\tws, _, err = UpdateWorkspace(ctx, ws.OID, name, icon, color, applyDefaults)\n\treturn ws, err\n}\n\n// Returns updated workspace, whether it was updated, error.\nfunc UpdateWorkspace(ctx context.Context, workspaceId string, name string, icon string, color string, applyDefaults bool) (*waveobj.Workspace, bool, error) {\n\tws, err := GetWorkspace(ctx, workspaceId)\n\tupdated := false\n\tif err != nil {\n\t\treturn nil, updated, fmt.Errorf(\"workspace %s not found: %w\", workspaceId, err)\n\t}\n\tif name != \"\" {\n\t\tws.Name = name\n\t\tupdated = true\n\t} else if applyDefaults && ws.Name == \"\" {\n\t\tws.Name = fmt.Sprintf(\"New Workspace (%s)\", ws.OID[0:5])\n\t\tupdated = true\n\t}\n\tif icon != \"\" {\n\t\tws.Icon = icon\n\t\tupdated = true\n\t} else if applyDefaults && ws.Icon == \"\" {\n\t\tws.Icon = WorkspaceIcons[0]\n\t\tupdated = true\n\t}\n\tif color != \"\" {\n\t\tws.Color = color\n\t\tupdated = true","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/workspace.go#L65-L101","documentation":"UpdateWorkspace could not load the target workspace before applying name/icon/color updates. GetWorkspace failed and the cause is wrapped. Indicates the workspaceId passed to UpdateWorkspace does not resolve to an existing workspace.","triggerScenarios":"Calling UpdateWorkspace with a stale/deleted workspace OID, a malformed id, or a workspace removed by another window/instance between listing and update.","commonSituations":"Frontend holds an outdated workspace id after another client deleted it; id typo or truncated OID; workspace deleted concurrently.","solutions":["Re-fetch the workspace list and confirm the id exists before updating","Verify the workspaceId is a full valid OID","If it was deleted, recreate the workspace or update a different one"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"workspaces, err := wcore.ListWorkspaces(ctx)\nif err != nil { return err }\nexists := false\nfor _, ws := range workspaces {\n    if ws.OID == workspaceId { exists = true; break }\n}\nif !exists { return fmt.Errorf(\"workspace %s does not exist\", workspaceId) }","typeGuard":null,"tryCatchPattern":"ws, _, err := wcore.UpdateWorkspace(ctx, wsId, name, icon, color, false)\nif err != nil && strings.Contains(err.Error(), \"not found\") {\n    // refresh UI workspace list and abort update\n    return nil\n}","preventionTips":["Always source workspace ids from a fresh ListWorkspaces call","Re-resolve ids after any delete operation","Never persist workspace ids across long-lived sessions without revalidation"],"tags":["go","workspace","not-found"],"backgroundTag":"record-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}