wavetermdev/waveterm · error
widget_id must be 8 characters
Error message
widget_id must be 8 characters
What it means
ResolveBlockIdFromPrefix resolves an 8-character block/widget id prefix to a full block id within a tab. It strictly validates the prefix length up front and rejects anything that is not exactly 8 characters with this literal message (the wording says widget_id but it applies to the blockIdPrefix argument).
Source
Thrown at pkg/wcore/wcore.go:131
if err != nil {
log.Printf("error getting object for update event: %v", err)
return
}
wps.Broker.Publish(wps.WaveEvent{
Event: wps.Event_WaveObjUpdate,
Scopes: []string{oref.String()},
Data: waveobj.WaveObjUpdate{
UpdateType: waveobj.UpdateType_Update,
OType: waveObj.GetOType(),
OID: waveobj.GetOID(waveObj),
Obj: waveObj,
},
})
}
func ResolveBlockIdFromPrefix(ctx context.Context, tabId string, blockIdPrefix string) (string, error) {
if len(blockIdPrefix) != 8 {
return "", fmt.Errorf("widget_id must be 8 characters")
}
tab, err := wstore.DBMustGet[*waveobj.Tab](ctx, tabId)
if err != nil {
return "", fmt.Errorf("error getting tab: %w", err)
}
for _, blockId := range tab.BlockIds {
if strings.HasPrefix(blockId, blockIdPrefix) {
return blockId, nil
}
}
return "", fmt.Errorf("widget_id not found: %q", blockIdPrefix)
}
func GoSendNoTelemetryUpdate(telemetryEnabled bool) {
go func() {View on GitHub (pinned to a4447c1563)
Solutions
- Pass exactly the first 8 characters of the block id
- Trim/validate the prefix before calling: strings.TrimSpace and len check
- If you have a full UUID, slice it: id[:8]
- Check the caller's serialization — some paths may pass an empty string
Example fix
// before
blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, fullBlockUUID)
// after
if len(fullBlockUUID) >= 8 {
blockId, err = wcore.ResolveBlockIdFromPrefix(ctx, tabId, fullBlockUUID[:8])
} Defensive patterns
Strategy: validation
Validate before calling
if len(strings.TrimSpace(blockIdPrefix)) != 8 {
return fmt.Errorf("prefix must be exactly 8 chars, got %d", len(blockIdPrefix))
} Prevention
- Always slice full UUIDs to id[:8] before resolving
- Trim user/tool-provided input
- Validate prefix length at the tool-call boundary
- Document the 8-char prefix contract in tool schemas
When it happens
Trigger: Calling ResolveBlockIdFromPrefix (directly or via CreateToolUseData, getTermScrollbackOutput, or AI tool-use handlers) with a blockIdPrefix whose len() != 8 — e.g. a full 36-char UUID, an empty string, or a truncated prefix of the wrong length.
Common situations: AI/tool integrations passing a full UUID block id instead of the 8-char prefix; frontends sending user-truncated text of arbitrary length; copy/paste errors in tool call arguments.
Related errors
- input is required
- widget_id not found: %q
- invalid simple id format: %s
- Image too large (>5MB)
- Unsupported or invalid image type: ${blob.type}
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/3714e1a37541926c.
Report an issue: GitHub.