wavetermdev/waveterm · error

error updating client data: %w

Error message

error updating client data: %w

What it means

AgreeTos wraps failures from wstore.DBUpdate with 'error updating client data: %w'. The Client record was loaded and TosAgreed set, but persisting it back to wstore failed. This is a database write failure, so the ToS agreement was NOT saved.

Source

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

	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)
	}
	return nil
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check the wrapped error for disk/permission causes and free space or fix permissions on the data dir
  2. Retry AgreeTos after resolving transient DB lock conditions
  3. If persistent, validate/repair the wstore DB file
Defensive patterns

Strategy: retry

Validate before calling

// check disk space / permissions on the data dir before write-heavy ops
info, err := os.Stat(dataDir)
if err != nil || info.Mode().Perm()&0200 == 0 { return fmt.Errorf("data dir not writable") }

Try / catch

for i := 0; i < 3; i++ {
    if _, err := cs.AgreeTos(ctx); err == nil { break }
    time.Sleep(200 * time.Millisecond)
}

Prevention

When it happens

Trigger: Calling AgreeTos when the wstore DB write fails: disk full, permissions issue, DB lock, or serialization error on the modified Client object.

Common situations: Read-only data directory or disk quota exceeded; another process holding the DB; corrupted wstore file failing the write.

Related errors


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