{"record":{"id":"3187cc470b55f50b","repo":"wavetermdev/waveterm","slug":"widget-id-not-found-q","errorCode":null,"errorMessage":"widget_id not found: %q","messagePattern":"widget_id not found: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wcore/wcore.go","lineNumber":145,"sourceCode":"}\n\nfunc ResolveBlockIdFromPrefix(ctx context.Context, tabId string, blockIdPrefix string) (string, error) {\n\tif len(blockIdPrefix) != 8 {\n\t\treturn \"\", fmt.Errorf(\"widget_id must be 8 characters\")\n\t}\n\n\ttab, err := wstore.DBMustGet[*waveobj.Tab](ctx, tabId)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting tab: %w\", err)\n\t}\n\n\tfor _, blockId := range tab.BlockIds {\n\t\tif strings.HasPrefix(blockId, blockIdPrefix) {\n\t\t\treturn blockId, nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"widget_id not found: %q\", blockIdPrefix)\n}\n\nfunc GoSendNoTelemetryUpdate(telemetryEnabled bool) {\n\tgo func() {\n\t\tdefer func() {\n\t\t\tpanichandler.PanicHandler(\"GoSendNoTelemetryUpdate\", recover())\n\t\t}()\n\t\tctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)\n\t\tdefer cancelFn()\n\t\tclientId := wstore.GetClientId()\n\t\terr := wcloud.SendNoTelemetryUpdate(ctx, clientId, !telemetryEnabled)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[error] sending no-telemetry update: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\t}()\n}\n","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wcore/wcore.go#L127-L163","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the block still exists in the specified tab","Verify the prefix belongs to the right tab — list tab.BlockIds and re-derive the prefix","Retry with a refreshed tab snapshot; the block may have been closed concurrently","Check for leading/trailing whitespace or case issues in the prefix"],"exampleFix":"// before\nblockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)\n// after\nblockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, strings.TrimSpace(prefix))\nif err != nil {\n    tab, _ := wstore.DBGet[*waveobj.Tab](ctx, tabId)\n    log.Printf(\"available blocks: %v\", tab.BlockIds)\n}","handlingStrategy":"try-catch","validationCode":"tab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)\nif err == nil {\n    matched := false\n    for _, b := range tab.BlockIds {\n        if strings.HasPrefix(b, prefix) { matched = true; break }\n    }\n    if !matched { return fmt.Errorf(\"no block matches %q in tab\", prefix) }\n}","typeGuard":null,"tryCatchPattern":"blockId, err := wcore.ResolveBlockIdFromPrefix(ctx, tabId, prefix)\nif err != nil {\n    return fmt.Errorf(\"block %q not resolvable, list current blocks and retry\", prefix)\n}","preventionTips":["Re-fetch tab state before each tool-use resolution","Treat closed blocks as retryable-with-replan for AI tools","Verify prefix against current tab.BlockIds","Avoid hardcoding block prefixes across sessions"],"tags":["not-found","block-id","validation"],"backgroundTag":"record-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}