wavetermdev/waveterm · error

input is required

Error message

input is required

What it means

parseWebNavigateInput rejects the web_navigate tool call when its input argument is nil. The tool requires an object carrying widget_id and url, and there is nothing to parse if the caller (typically the AI tool runner) passed no input at all. This is a guard against serializing a missing argument.

Source

Thrown at pkg/aiusechat/tools_web.go:27

	"fmt"
	"time"

	"github.com/wavetermdev/waveterm/pkg/aiusechat/uctypes"
	"github.com/wavetermdev/waveterm/pkg/waveobj"
	"github.com/wavetermdev/waveterm/pkg/wcore"
	"github.com/wavetermdev/waveterm/pkg/wstore"
)

type WebNavigateToolInput struct {
	WidgetId string `json:"widget_id"`
	Url      string `json:"url"`
}

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")
	}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Ensure the model call includes both widget_id and url arguments; re-prompt or strengthen the tool's InputSchema/required fields if arguments are being omitted.
  2. In the calling harness, default nil input to an empty map[string]any{} so validation produces the more specific 'widget_id is required' message instead.
  3. Reject the tool call client-side before invoking the callback when arguments are absent.
  4. If a test triggers this, pass a valid input struct/map with widget_id and url set.

Example fix

// before: callback(nil) returns 'input is required'; // after: callback(map[string]any{"widget_id": "AB12CD34", "url": "https://example.com"})
Defensive patterns

Strategy: validation

Validate before calling

if input == nil { return errors.New("web_navigate requires input with widget_id and url") }; m, ok := input.(map[string]any); if !ok || m["widget_id"] == nil || m["url"] == nil { return errors.New("web_navigate requires widget_id and url") }

Type guard

func hasWebNavigateArgs(input any) bool { m, ok := input.(map[string]any); return ok && m["widget_id"] != nil && m["url"] != nil }

Try / catch

parsed, err := parseWebNavigateInput(input); if err != nil { return nil, fmt.Errorf("web_navigate: %w", err) /* surfaces 'input is required' to the model for retry */ }

Prevention

When it happens

Trigger: The web_navigate tool callback is invoked with input == nil - e.g. the model emitted a tool call with no arguments, or a harness invoked the callback without an input object.

Common situations: LLM emits an empty/omitted arguments object for web_navigate; strict-mode mismatch where the client strips arguments; a test invoking the tool callback with nil input.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/cce6342cd5dc17fa. Report an issue: GitHub.