wavetermdev/waveterm · critical
error updating client: %w
Error message
error updating client: %w
What it means
EnsureInitialData generates a TempOID for a client record that lacks one and persists it via wstore.DBUpdate. This error wraps a failure of that DB update, so the client record could not be written back to the store during startup initialization.
Source
Thrown at pkg/wcore/wcore.go:50
func EnsureInitialData() (bool, error) {
// does not need to run in a transaction since it is called on startup
ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second)
defer cancelFn()
client, err := wstore.DBGetSingleton[*waveobj.Client](ctx)
firstLaunch := false
if err == wstore.ErrNotFound {
client, err = CreateClient(ctx)
if err != nil {
return false, fmt.Errorf("error creating client: %w", err)
}
firstLaunch = true
}
if client.TempOID == "" {
log.Println("client.TempOID is empty")
client.TempOID = uuid.NewString()
err = wstore.DBUpdate(ctx, client)
if err != nil {
return firstLaunch, fmt.Errorf("error updating client: %w", err)
}
}
if client.InstallId == "" {
log.Println("client.InstallId is empty")
client.InstallId = uuid.NewString()
err = wstore.DBUpdate(ctx, client)
if err != nil {
return firstLaunch, fmt.Errorf("error updating client: %w", err)
}
}
log.Printf("clientid: %s\n", client.OID)
wstore.SetClientId(client.OID)
if len(client.WindowIds) == 1 {
log.Println("client has one window")
CheckAndFixWindow(ctx, client.WindowIds[0])
return firstLaunch, nil
}
if len(client.WindowIds) > 0 {View on GitHub (pinned to a4447c1563)
Solutions
- Check Wave data directory (~/.waveterm) permissions and free disk space
- Delete/rename the possibly corrupted wavetool DB and relaunch to reinitialize
- Check logs for the wrapped wstore error (e.g. 'database is locked') and address that cause
- Ensure no other Wave instance is running and holding the DB lock
Defensive patterns
Strategy: try-catch
Validate before calling
clientData, err := wcore.GetClientData(ctx)
if err != nil { return err }
if clientData.TempOID == "" { log.Println("TempOID will be generated; ensure DB is writable") } Try / catch
firstLaunch, err := wcore.EnsureInitialData(ctx)
if err != nil {
var wrapped *fmt.wrapError
if errors.As(err, &wrapped) { log.Printf("init failed: %v", wrapped.Unwrap()) }
return err
} Prevention
- Ensure ~/.waveterm is writable before launching
- Close other Wave instances to avoid DB locks
- Monitor disk space on the data directory volume
- Check DB integrity after OS crashes
When it happens
Trigger: wstore.DBUpdate(ctx, client) returns an error while persisting the newly generated TempOID — e.g. the wavetool DB is corrupt/locked, the client singleton row is missing, or the DB write fails on disk I/O.
Common situations: First launch on a machine with a corrupted or read-only Wave data directory; concurrent Wave processes contending for the sqlite database; disk full or permission errors on ~/.waveterm.
Related errors
- error getting client: %v
- opening db: %w
- error inserting client: %w
- error inserting mainserver: %w
- error getting mainserver: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/a07ce411314855da.
Report an issue: GitHub.