wavetermdev/waveterm · error
error creating window: %w
Error message
error creating window: %w
What it means
Returned when a new window cannot be created, typically a platform window-system or resource failure. The underlying error is wrapped with %w.
Source
Thrown at pkg/wcore/wcore.go:83
CheckAndFixWindow(ctx, client.WindowIds[0])
return firstLaunch, nil
}
if len(client.WindowIds) > 0 {
log.Println("client has windows")
return firstLaunch, nil
}
wsId := ""
if firstLaunch {
log.Println("client has no windows and first launch, creating starter workspace")
starterWs, err := CreateWorkspace(ctx, "Starter workspace", "custom@wave-logo-solid", "#58C142", false, true)
if err != nil {
return firstLaunch, fmt.Errorf("error creating starter workspace: %w", err)
}
wsId = starterWs.OID
}
_, err = CreateWindow(ctx, nil, wsId)
if err != nil {
return firstLaunch, fmt.Errorf("error creating window: %w", err)
}
return firstLaunch, nil
}
func CreateClient(ctx context.Context) (*waveobj.Client, error) {
client := &waveobj.Client{
OID: uuid.NewString(),
WindowIds: []string{},
}
err := wstore.DBInsert(ctx, client)
if err != nil {
return nil, fmt.Errorf("error inserting client: %w", err)
}
return client, nil
}
func GetClientData(ctx context.Context) (*waveobj.Client, error) {
clientData, err := wstore.DBGetSingleton[*waveobj.Client](ctx)View on GitHub (pinned to a4447c1563)
Solutions
- Inspect the wrapped CreateWindow error for the root cause
- Verify the workspace referenced by wsId exists in the DB
- Delete/rename the Wave DB and relaunch for clean initialization
- Check for concurrent Wave processes corrupting window state
Defensive patterns
Strategy: try-catch
Validate before calling
ws, err := wstore.DBGet[*waveobj.Workspace](ctx, wsId) // ensure ws != nil before window creation proceeds
Try / catch
_, err := wcore.CreateWindow(ctx, nil, wsId)
if err != nil && strings.Contains(err.Error(), "creating window") {
log.Printf("window creation failed: %v", err)
} Prevention
- Pass a valid workspace OID (empty string for default on first launch)
- Don't close windows concurrently during startup
- Validate wsId exists in the DB before CreateWindow
- Keep a clean DB state during upgrades
When it happens
Trigger: CreateWindow fails during initial startup — e.g. the workspace id passed is invalid, or the wstore insert/update of the new window object fails.
Common situations: First launch where window creation hit a DB error; a stale/corrupt client.WindowIds entry; an invalid wsId after a failed starter workspace creation.
Related errors
- error getting window: %w
- error creating starter workspace: %w
- error getting all windows: %w
- error getting client: %v
- error getting block: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/45103ff7c3d117ea.
Report an issue: GitHub.