wavetermdev/waveterm · error
missing contents parameter
Error message
missing contents parameter
What it means
Input unmarshaled fine but the required Contents field is the empty string. The write-app-file tool refuses to write an empty file body, treating it as a missing parameter. Because Contents is a string, omitted and "" are indistinguishable here — both trigger this error.
Source
Thrown at pkg/aiusechat/tools_builder.go:71
"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),
ToolLogName: "builder:write_app",
Strict: false,
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{
"contents": map[string]any{
"type": "string",
"description": "The contents to write to app.go",View on GitHub (pinned to a4447c1563)
Solutions
- Provide non-empty contents: {"contents": "<file text>"}
- If the intent is an empty/blank file, pass at least a placeholder (e.g. "\n") or use a delete operation instead
- Strengthen the tool description to state contents must be non-empty
Example fix
// before
{"file": "app.tsx", "contents": ""}
// after
{"file": "app.tsx", "contents": "export default function App() { return null }"} Defensive patterns
Strategy: validation
Validate before calling
if m, ok := input.(map[string]any); ok { if c, _ := m["contents"].(string); c == "" { return errors.New("contents must be a non-empty string") } } Type guard
func hasContents(input any) bool { m, ok := input.(map[string]any); if !ok { return false }; s, ok := m["contents"].(string); return ok && s != "" } Try / catch
params, err := parseBuilderWriteAppFileInput(input); if err != nil && strings.Contains(err.Error(), "missing contents") { return fmt.Errorf("refusing to write empty file: %w", err) } Prevention
- Always include non-empty contents in write-app-file calls
- Use a delete/edit tool instead of writing empty content to clear a file
- Guard long contents against truncation before sending
When it happens
Trigger: Tool called with {} or {"contents": ""} — the contents key absent or explicitly empty after unmarshal.
Common situations: Model generating an empty file body (e.g. it intended to only create the file); prompt asking to 'clear' a file where a delete/edit op was appropriate; truncation cutting off long contents.
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
- missing edits parameter
- missing values parameter
- input is required
- invalid input format: %w
- invalid input format
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/8bdfab29f23571e6.
Report an issue: GitHub.