wavetermdev/waveterm · error

widget_id not found: %q

Error message

widget_id not found: %q

What it means

If the tab exists but none of its BlockIds starts with the given 8-char prefix, ResolveBlockIdFromPrefix returns this error quoting the prefix. It means no block in that tab matches the supplied id fragment.

Source

Thrown at pkg/wcore/wcore.go:145

}

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() {
		defer func() {
			panichandler.PanicHandler("GoSendNoTelemetryUpdate", recover())
		}()
		ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
		defer cancelFn()
		clientId := wstore.GetClientId()
		err := wcloud.SendNoTelemetryUpdate(ctx, clientId, !telemetryEnabled)
		if err != nil {
			log.Printf("[error] sending no-telemetry update: %v\n", err)
			return
		}
	}()
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Confirm the block still exists in the specified tab
  2. Verify the prefix belongs to the right tab — list tab.BlockIds and re-derive the prefix
  3. Retry with a refreshed tab snapshot; the block may have been closed concurrently
  4. Check for leading/trailing whitespace or case issues in the prefix

Example fix

// before
blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)
// after
blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, strings.TrimSpace(prefix))
if err != nil {
    tab, _ := wstore.DBGet[*waveobj.Tab](ctx, tabId)
    log.Printf("available blocks: %v", tab.BlockIds)
}
Defensive patterns

Strategy: try-catch

Validate before calling

tab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)
if err == nil {
    matched := false
    for _, b := range tab.BlockIds {
        if strings.HasPrefix(b, prefix) { matched = true; break }
    }
    if !matched { return fmt.Errorf("no block matches %q in tab", prefix) }
}

Try / catch

blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)
if err != nil {
    return fmt.Errorf("block %q not resolvable, list current blocks and retry", prefix)
}

Prevention

When it happens

Trigger: The prefix is well-formed but refers to a block that was closed, belongs to a different tab, or simply never existed in tab.BlockIds.

Common situations: AI/tool calls referencing a block after the user closed it; prefix belonging to a block in another tab; typos in the prefix; stale tab state in long-running sessions.

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/3187cc470b55f50b. Report an issue: GitHub.