wavetermdev/waveterm · error

error inserting workspace: %w

Error message

error inserting workspace: %w

What it means

CreateWorkspace failed while persisting the new workspace object via wstore.DBInsert. The wrapped error (%w) carries the underlying storage failure (SQLite/JSON store write error). Thrown by Wave Terminal's wcore workspace layer when a workspace record cannot be written to the backing store.

Source

Thrown at pkg/wcore/workspace.go:63

	"rocket",
	"flask",
	"paperclip",
	"chart-line",
	"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

View on GitHub (pinned to a4447c1563)

Solutions

  1. Inspect the wrapped cause printed with this message to find the storage error
  2. Check disk space and write permissions on the Wave data directory (~/.waveterm)
  3. Quit all Wave instances and back up, then remove/rebuild a corrupted DB file
  4. Retry CreateWorkspace after fixing storage
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: check store availability first
if _, err := os.Stat(wavebase.GetWaveDataDir()); err != nil {
    return fmt.Errorf("wave data dir unavailable: %w", err)
}

Try / catch

ws, err := wcore.CreateWorkspace(ctx, "", "", "", false)
if err != nil {
    var wrapped error
    if errors.As(err, &wrapped) { log.Printf("cause: %v", wrapped) }
    return fmt.Errorf("workspace create failed: %w", err)
}

Prevention

When it happens

Trigger: Calling CreateWorkspace, EnsureInitialData, or CreateWindow when wstore.DBInsert on the new *waveobj.Workspace fails (DB closed, corrupted store, disk full, permission denied on the data dir).

Common situations: Corrupt or locked waveterm database file in the data directory; read-only filesystem; disk quota exceeded; concurrent multi-instance writes to the same store.

Related errors


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