wavetermdev/waveterm · error

error getting client data: %w

Error message

error getting client data: %w

What it means

AgreeTos wraps failures from wstore.DBGetSingleton[*waveobj.Client] with 'error getting client data: %w'. The Client record is a singleton in wstore; this error means the singleton read failed — typically the Client row is missing or the DB read errored. AgreeTos cannot proceed without loading the Client record.

Source

Thrown at pkg/service/clientservice/clientservice.go:57

	return tab, nil
}

func (cs *ClientService) GetAllConnStatus(ctx context.Context) ([]wshrpc.ConnStatus, error) {
	sshStatuses := conncontroller.GetAllConnStatus()
	wslStatuses := wslconn.GetAllConnStatus()
	return append(sshStatuses, wslStatuses...), nil
}

// moves the window to the front of the windowId stack
func (cs *ClientService) FocusWindow(ctx context.Context, windowId string) error {
	return wcore.FocusWindow(ctx, windowId)
}

func (cs *ClientService) AgreeTos(ctx context.Context) (waveobj.UpdatesRtnType, error) {
	ctx = waveobj.ContextWithUpdates(ctx)
	clientData, err := wstore.DBGetSingleton[*waveobj.Client](ctx)
	if err != nil {
		return nil, fmt.Errorf("error getting client data: %w", err)
	}
	timestamp := time.Now().UnixMilli()
	clientData.TosAgreed = timestamp
	err = wstore.DBUpdate(ctx, clientData)
	if err != nil {
		return nil, fmt.Errorf("error updating client data: %w", err)
	}
	wcore.BootstrapStarterLayout(ctx)
	return waveobj.ContextGetUpdatesRtn(ctx), nil
}

func (cs *ClientService) TelemetryUpdate(ctx context.Context, telemetryEnabled bool) error {
	meta := waveobj.MetaMapType{
		wconfig.ConfigKey_TelemetryEnabled: telemetryEnabled,
	}
	err := wconfig.SetBaseConfigValue(meta)
	if err != nil {
		return fmt.Errorf("error setting telemetry value: %w", err)

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check the wrapped error: 'key not found' means the Client singleton is missing — restart the app to re-run bootstrap
  2. Ensure WAVE_HOME/data dir points at the real Wave Terminal data directory
  3. If the DB is corrupted, restore/backup the wstore file and let the app recreate it

Example fix

// before
_, err := cs.AgreeTos(ctx)
// after
if _, err := cs.AgreeTos(ctx); err != nil && strings.Contains(err.Error(), "key not found") {
    // re-bootstrap client data, then retry
    err = bootstrapClient(ctx)
}
Defensive patterns

Strategy: try-catch

Try / catch

updates, err := cs.AgreeTos(ctx)
if err != nil {
    if strings.Contains(err.Error(), "key not found") { /* re-bootstrap client data */ }
    return err
}

Prevention

When it happens

Trigger: Calling ClientService.AgreeTos when the wstore has no Client singleton (fresh/corrupted DB) or the singleton read fails on I/O error.

Common situations: First-run with an uninitialized or partially migrated DB; manual deletion/corruption of the wstore file; running with a misconfigured WAVE_HOME pointing at an empty data dir.

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/3ae80438ccf26732. Report an issue: GitHub.