wavetermdev/waveterm · error
widget_id is required
Error message
widget_id is required
What it means
After successfully decoding the input into WebNavigateToolInput, the parser validates that widget_id is a non-empty string. The web_navigate tool needs the 8-character widget ID to locate the target web browser widget block, so a missing or empty widget_id is rejected. This catches arguments the JSON schema did not enforce (or that the model omitted while still providing url).
Source
Thrown at pkg/aiusechat/tools_web.go:40
func parseWebNavigateInput(input any) (*WebNavigateToolInput, error) {
result := &WebNavigateToolInput{}
if input == nil {
return nil, fmt.Errorf("input is required")
}
inputBytes, err := json.Marshal(input)
if err != nil {
return nil, fmt.Errorf("failed to marshal input: %w", err)
}
if err := json.Unmarshal(inputBytes, result); err != nil {
return nil, fmt.Errorf("failed to unmarshal input: %w", err)
}
if result.WidgetId == "" {
return nil, fmt.Errorf("widget_id is required")
}
if result.Url == "" {
return nil, fmt.Errorf("url is required")
}
return result, nil
}
func GetWebNavigateToolDefinition(tabId string) uctypes.ToolDefinition {
return uctypes.ToolDefinition{
Name: "web_navigate",
DisplayName: "Navigate Web Widget",
Description: "Navigate a web browser widget to a new URL",
ToolLogName: "web:navigate",
Strict: true,
InputSchema: map[string]any{View on GitHub (pinned to a4447c1563)
Solutions
- Re-issue the tool call including the widget's 8-character widget_id (visible in the Wave Terminal UI / block list).
- List available web widgets first (via the AI tools that enumerate blocks/widgets) to obtain the correct widget_id before navigating.
- Tighten the tool InputSchema (required: ["widget_id","url"], minLength: 8 for widget_id) so the model is forced to supply it.
- If the widget was closed, its ID is stale - reopen a web widget and use the new ID.
Example fix
// before: callback(map[string]any{"url": "https://example.com"}) returns 'widget_id is required'; // after: callback(map[string]any{"widget_id": "AB12CD34", "url": "https://example.com"}) Defensive patterns
Strategy: validation
Validate before calling
m, ok := input.(map[string]any); if !ok { return errors.New("input must be an object") }; wid, _ := m["widget_id"].(string); if wid == "" { return errors.New("widget_id is required") } Type guard
func hasWidgetID(input any) bool { m, ok := input.(map[string]any); if !ok { return false }; w, ok := m["widget_id"].(string); return ok && w != "" } Try / catch
parsed, err := parseWebNavigateInput(input); if err != nil && strings.Contains(err.Error(), "widget_id is required") { /* ask the model to supply the 8-character widget id, or list widgets for it */ } Prevention
- Ensure required: [widget_id, url] is present in the tool InputSchema.
- Provide the model the list of web widget IDs in context so it can fill widget_id.
- Validate widget_id length (8 chars) before calling to catch truncated IDs.
- Handle closed widgets: refresh the widget list if a formerly valid ID stops working.
When it happens
Trigger: The web_navigate callback receives input where the widget_id field is absent or the empty string, e.g. {"url": "https://example.com"} or {"widget_id": "", "url": "..."}.
Common situations: The model omits widget_id because it does not know the widget's 8-character ID; the harness sends a partially-filled struct; a template or script generates the call with an unfilled placeholder.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- input is required
- failed to unmarshal input: %w
- Image too large (>5MB)
- Unsupported or invalid image type: ${blob.type}
- Invalid CSS color: ${String(color)}
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/b5f4cb8f566ef535.
Report an issue: GitHub.