wavetermdev/waveterm · error

error creating tab: %w

Error message

error creating tab: %w

What it means

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.

Source

Thrown at pkg/wcore/workspace.go:67

	"graduation-cap",
	"mug-hot",
}

func CreateWorkspace(ctx context.Context, name string, icon string, color string, applyDefaults bool, isInitialLaunch bool) (*waveobj.Workspace, error) {
	ws := &waveobj.Workspace{
		OID:    uuid.NewString(),
		TabIds: []string{},
		Name:   "",
		Icon:   "",
		Color:  "",
	}
	err := wstore.DBInsert(ctx, ws)
	if err != nil {
		return nil, fmt.Errorf("error inserting workspace: %w", err)
	}
	_, err = CreateTab(ctx, ws.OID, "", true, isInitialLaunch)
	if err != nil {
		return nil, fmt.Errorf("error creating tab: %w", err)
	}

	wps.Broker.Publish(wps.WaveEvent{
		Event: wps.Event_WorkspaceUpdate,
	})

	ws, _, err = UpdateWorkspace(ctx, ws.OID, name, icon, color, applyDefaults)
	return ws, err
}

// Returns updated workspace, whether it was updated, error.
func UpdateWorkspace(ctx context.Context, workspaceId string, name string, icon string, color string, applyDefaults bool) (*waveobj.Workspace, bool, error) {
	ws, err := GetWorkspace(ctx, workspaceId)
	updated := false
	if err != nil {
		return nil, updated, fmt.Errorf("workspace %s not found: %w", workspaceId, err)
	}
	if name != "" {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Read the wrapped cause for the specific tab/block failure
  2. Verify DB write access and disk space
  3. Fix the underlying CreateTab error then retry workspace creation
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure storage writable before creating
f, err := os.CreateTemp(wavebase.GetWaveDataDir(), "probe")
if err == nil { f.Close(); os.Remove(f.Name()) }

Try / catch

ws, err := wcore.CreateWorkspace(ctx, "", "", "", true)
if err != nil {
    if strings.Contains(err.Error(), "error creating tab") {
        log.Printf("tab creation failed: %v", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling CreateWorkspace / EnsureInitialData / CreateWindow where CreateTab(ctx, ws.OID, "", true, isInitialLaunch) returns an error, e.g. inner DBInsert of the tab fails.

Common situations: Same storage problems as insert failures (disk full, permissions), or errors during creation of the tab's default blocks.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/34ab2266fa823a35. Report an issue: GitHub.