wavetermdev/waveterm · error
input is required
Error message
input is required
What it means
parseBuilderWriteAppFileInput validates raw input for the builder write-app-file tool. A nil input cannot be unmarshaled into builderWriteAppFileParams, so nil is rejected immediately with this sentinel error before ReUnmarshal is attempted.
Source
Thrown at pkg/aiusechat/tools_builder.go:63
return map[string]any{
"build_success": false,
"build_error": err.Error(),
"build_output": "",
}
}
return map[string]any{
"build_success": result.Success,
"build_error": result.ErrorMessage,
"build_output": result.BuildOutput,
}
}
func parseBuilderWriteAppFileInput(input any) (*builderWriteAppFileParams, error) {
result := &builderWriteAppFileParams{}
if input == nil {
return nil, fmt.Errorf("input is required")
}
if err := utilfn.ReUnmarshal(result, input); err != nil {
return nil, fmt.Errorf("invalid input format: %w", err)
}
if result.Contents == "" {
return nil, fmt.Errorf("missing contents parameter")
}
return result, nil
}
func GetBuilderWriteAppFileToolDefinition(appId string, builderId string) uctypes.ToolDefinition {
return uctypes.ToolDefinition{
Name: "builder_write_app_file",
DisplayName: "Write App File",
Description: fmt.Sprintf("Write the app.go file for app %s", appId),View on GitHub (pinned to a4447c1563)
Solutions
- Always pass a JSON object as tool input, at minimum {"contents": "..."}
- Fix any upstream argument-decoding layer so it produces an empty map {} rather than nil on parse failure
- If calling parseBuilderWriteAppFileInput directly (tests), pass map[string]any{"contents": ...} not nil
Example fix
// before
parseBuilderWriteAppFileInput(nil)
// after
parseBuilderWriteAppFileInput(map[string]any{"contents": "file body"}) Defensive patterns
Strategy: validation
Validate before calling
if input == nil { input = map[string]any{} }; if _, ok := input.(map[string]any); !ok { return errors.New("tool input must be an object") } Type guard
func nonNilObject(input any) (map[string]any, bool) { if input == nil { return nil, false }; m, ok := input.(map[string]any); return m, ok } Try / catch
params, err := parseBuilderWriteAppFileInput(input); if err != nil { if err.Error() == "input is required" { input = map[string]any{} } else { return err } } Prevention
- Never forward nil tool arguments; default to an empty object
- Fix dispatch layers to surface JSON decode errors instead of passing nil
- Ensure tool calls always serialize an arguments object, even when minimal
When it happens
Trigger: The builder tool is invoked with input == nil: no arguments object supplied at all, or an upstream layer passes nil through when arguments parsing failed silently.
Common situations: LLM tool call with empty arguments; a dispatch layer that swallows JSON parse errors and forwards nil; calling the parse function directly in tests with a nil argument.
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
- invalid input format: %w
- missing contents parameter
- missing edits parameter
- invalid input format
- missing values parameter
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/f07a44136790b7eb.
Report an issue: GitHub.