{"record":{"id":"34ab2266fa823a35","repo":"wavetermdev/waveterm","slug":"error-creating-tab-w-34ab22","errorCode":null,"errorMessage":"error creating tab: %w","messagePattern":"error creating tab: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/workspace.go","lineNumber":67,"sourceCode":"\t\"graduation-cap\",\n\t\"mug-hot\",\n}\n\nfunc CreateWorkspace(ctx context.Context, name string, icon string, color string, applyDefaults bool, isInitialLaunch bool) (*waveobj.Workspace, error) {\n\tws := &waveobj.Workspace{\n\t\tOID:    uuid.NewString(),\n\t\tTabIds: []string{},\n\t\tName:   \"\",\n\t\tIcon:   \"\",\n\t\tColor:  \"\",\n\t}\n\terr := wstore.DBInsert(ctx, ws)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error inserting workspace: %w\", err)\n\t}\n\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 != \"\" {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/workspace.go#L49-L85","documentation":"CreateWorkspace inserted the workspace but the follow-up CreateTab call for its initial empty tab failed. The wrapped error identifies why tab creation failed (tab insert or block init failure). Returned so callers never get a workspace without its initial tab.","triggerScenarios":"Calling CreateWorkspace / EnsureInitialData / CreateWindow where CreateTab(ctx, ws.OID, \"\", true, isInitialLaunch) returns an error, e.g. inner DBInsert of the tab fails.","commonSituations":"Same storage problems as insert failures (disk full, permissions), or errors during creation of the tab's default blocks.","solutions":["Read the wrapped cause for the specific tab/block failure","Verify DB write access and disk space","Fix the underlying CreateTab error then retry workspace creation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure storage writable before creating\nf, err := os.CreateTemp(wavebase.GetWaveDataDir(), \"probe\")\nif err == nil { f.Close(); os.Remove(f.Name()) }","typeGuard":null,"tryCatchPattern":"ws, err := wcore.CreateWorkspace(ctx, \"\", \"\", \"\", true)\nif err != nil {\n    if strings.Contains(err.Error(), \"error creating tab\") {\n        log.Printf(\"tab creation failed: %v\", err)\n    }\n    return err\n}","preventionTips":["Fix disk/permission issues before bulk workspace creation","Monitor logs for repeated CreateTab failures","Keep block-init dependencies healthy on initial launch"],"tags":["go","database","tab"],"backgroundTag":"database-insert-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}