wavetermdev/waveterm · error

workspace %s not found: %w

Error message

workspace %s not found: %w

What it means

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.

Source

Thrown at pkg/wcore/workspace.go:83

	_, 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 != "" {
		ws.Name = name
		updated = true
	} else if applyDefaults && ws.Name == "" {
		ws.Name = fmt.Sprintf("New Workspace (%s)", ws.OID[0:5])
		updated = true
	}
	if icon != "" {
		ws.Icon = icon
		updated = true
	} else if applyDefaults && ws.Icon == "" {
		ws.Icon = WorkspaceIcons[0]
		updated = true
	}
	if color != "" {
		ws.Color = color
		updated = true

View on GitHub (pinned to a4447c1563)

Solutions

  1. Re-fetch the workspace list and confirm the id exists before updating
  2. Verify the workspaceId is a full valid OID
  3. If it was deleted, recreate the workspace or update a different one
Defensive patterns

Strategy: validation

Validate before calling

workspaces, err := wcore.ListWorkspaces(ctx)
if err != nil { return err }
exists := false
for _, ws := range workspaces {
    if ws.OID == workspaceId { exists = true; break }
}
if !exists { return fmt.Errorf("workspace %s does not exist", workspaceId) }

Try / catch

ws, _, err := wcore.UpdateWorkspace(ctx, wsId, name, icon, color, false)
if err != nil && strings.Contains(err.Error(), "not found") {
    // refresh UI workspace list and abort update
    return nil
}

Prevention

When it happens

Trigger: Calling UpdateWorkspace with a stale/deleted workspace OID, a malformed id, or a workspace removed by another window/instance between listing and update.

Common situations: Frontend holds an outdated workspace id after another client deleted it; id typo or truncated OID; workspace deleted concurrently.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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