wavetermdev/waveterm · error
missing edits parameter
Error message
missing edits parameter
What it means
Input unmarshaled into builderEditAppFileParams successfully, but the Edits slice is empty (len == 0). An edit tool call with no edits is a no-op, so it's rejected as missing the required parameter, prompting the caller to supply at least one find/replace edit.
Source
Thrown at pkg/aiusechat/tools_builder.go:167
}
type builderEditAppFileParams struct {
Edits []fileutil.EditSpec `json:"edits"`
}
func parseBuilderEditAppFileInput(input any) (*builderEditAppFileParams, error) {
result := &builderEditAppFileParams{}
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 len(result.Edits) == 0 {
return nil, fmt.Errorf("missing edits parameter")
}
return result, nil
}
func formatEditDescriptions(edits []fileutil.EditSpec) []string {
numEdits := len(edits)
editStr := "edits"
if numEdits == 1 {
editStr = "edit"
}
result := make([]string, len(edits)+1)
result[0] = fmt.Sprintf("editing app.go (%d %s)", numEdits, editStr)
for i, edit := range edits {
newLines := len(strings.Split(edit.NewStr, "\n"))
oldLines := len(strings.Split(edit.OldStr, "\n"))View on GitHub (pinned to a4447c1563)
Solutions
- Include at least one edit object: {"edits": [{"find": "old", "replace": "new"}]}
- Skip the tool call entirely in caller logic when no edits are pending
- Add prompt/tool-description guidance that edits must contain one or more find/replace entries
Example fix
// before
{"edits": []}
// after
{"edits": [{"find": "foo", "replace": "bar"}]} Defensive patterns
Strategy: validation
Validate before calling
if m, ok := input.(map[string]any); ok { if e, _ := m["edits"].([]any); len(e) == 0 { return errors.New("edits must contain at least one entry") } } Type guard
func hasEdits(input any) bool { m, ok := input.(map[string]any); if !ok { return false }; e, ok := m["edits"].([]any); return ok && len(e) > 0 } Try / catch
params, err := parseBuilderEditAppFileInput(input); if err != nil && strings.Contains(err.Error(), "missing edits") { return fmt.Errorf("no-op edit rejected: %w", err) } Prevention
- Only call the edit tool when at least one find/replace is pending
- Skip the call and return early when the edits list is empty
- State in the tool description that edits must be a non-empty array
When it happens
Trigger: Tool called with {} or {"edits": []} — edits key missing or an empty array supplied.
Common situations: Model deciding nothing needs changing but still calling the tool; a loop that exhausts edits before invoking; client code building an empty edits slice by mistake.
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 contents 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/ae65743545517313.
Report an issue: GitHub.