{"record":{"id":"cce6342cd5dc17fa","repo":"wavetermdev/waveterm","slug":"input-is-required-cce634","errorCode":null,"errorMessage":"input is required","messagePattern":"input is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/aiusechat/tools_web.go","lineNumber":27,"sourceCode":"\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/wavetermdev/waveterm/pkg/aiusechat/uctypes\"\n\t\"github.com/wavetermdev/waveterm/pkg/waveobj\"\n\t\"github.com/wavetermdev/waveterm/pkg/wcore\"\n\t\"github.com/wavetermdev/waveterm/pkg/wstore\"\n)\n\ntype WebNavigateToolInput struct {\n\tWidgetId string `json:\"widget_id\"`\n\tUrl      string `json:\"url\"`\n}\n\nfunc parseWebNavigateInput(input any) (*WebNavigateToolInput, error) {\n\tresult := &WebNavigateToolInput{}\n\n\tif input == nil {\n\t\treturn nil, fmt.Errorf(\"input is required\")\n\t}\n\n\tinputBytes, err := json.Marshal(input)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal input: %w\", err)\n\t}\n\n\tif err := json.Unmarshal(inputBytes, result); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal input: %w\", err)\n\t}\n\n\tif result.WidgetId == \"\" {\n\t\treturn nil, fmt.Errorf(\"widget_id is required\")\n\t}\n\n\tif result.Url == \"\" {\n\t\treturn nil, fmt.Errorf(\"url is required\")\n\t}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/aiusechat/tools_web.go#L9-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","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.","Reject the tool call client-side before invoking the callback when arguments are absent.","If a test triggers this, pass a valid input struct/map with widget_id and url set."],"exampleFix":"// before: callback(nil) returns 'input is required'; // after: callback(map[string]any{\"widget_id\": \"AB12CD34\", \"url\": \"https://example.com\"})","handlingStrategy":"validation","validationCode":"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\") }","typeGuard":"func hasWebNavigateArgs(input any) bool { m, ok := input.(map[string]any); return ok && m[\"widget_id\"] != nil && m[\"url\"] != nil }","tryCatchPattern":"parsed, err := parseWebNavigateInput(input); if err != nil { return nil, fmt.Errorf(\"web_navigate: %w\", err) /* surfaces 'input is required' to the model for retry */ }","preventionTips":["Enforce the tool InputSchema with required: [widget_id, url] and strict mode so the model always emits arguments.","Reject tool calls with missing arguments in the harness before invoking callbacks.","Default nil input to an empty map so validation yields the more specific missing-field error.","Include argument examples in the tool description to reduce omitted-argument rates."],"tags":["validation","input","tool-call","web"],"backgroundTag":"missing-required-input","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}