{"record":{"id":"2c33a44c6aa238be","repo":"wavetermdev/waveterm","slug":"missing-values-parameter","errorCode":null,"errorMessage":"missing values parameter","messagePattern":"missing values parameter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/aiusechat/tools.go","lineNumber":294,"sourceCode":"\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\"items\": map[string]any{\n\t\t\t\t\t\t\"type\": \"integer\",\n\t\t\t\t\t},\n\t\t\t\t\t\"description\": \"Array of numbers to add together\",\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"required\":             []string{\"values\"},\n\t\t\t\"additionalProperties\": false,\n\t\t},\n\t\tToolAnyCallback: func(input any, toolUseData *uctypes.UIMessageDataToolUse) (any, error) {\n\t\t\tinputMap, ok := input.(map[string]any)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid input format\")\n\t\t\t}\n\n\t\t\tvaluesInterface, ok := inputMap[\"values\"]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"missing values parameter\")\n\t\t\t}\n\n\t\t\tvaluesSlice, ok := valuesInterface.([]any)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"values must be an array\")\n\t\t\t}\n\n\t\t\tif len(valuesSlice) == 0 {\n\t\t\t\treturn 0, nil\n\t\t\t}\n\n\t\t\tsum := 0\n\t\t\tfor i, val := range valuesSlice {\n\t\t\t\tfloatVal, ok := val.(float64)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"value at index %d is not a number\", i)\n\t\t\t\t}\n\t\t\t\tsum += int(floatVal)","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/aiusechat/tools.go#L276-L312","documentation":"The tool callback successfully coerced input to a map but the required key \"values\" is absent. The tool's JSON schema declares \"values\" as required, so a call omitting it violates the contract and this error is returned to the model so it can retry with correct arguments.","triggerScenarios":"LLM invokes the any-sum tool with an object that lacks the \"values\" key, e.g. {} or {\"numbers\": [1,2]} — schema-required parameter missing from the arguments map.","commonSituations":"Model hallucinating alternate parameter names (numbers, list, items); truncation of generated arguments; hand-written tool call payloads missing the key; prompt instructions that don't name the parameter explicitly.","solutions":["Include the required \"values\" key in the tool arguments: {\"values\": [1,2,3]}","Improve the tool description/prompt so the model uses the exact parameter name \"values\"","If the schema is rendered for the model, confirm the required:[\"values\"] constraint is being advertised to the client"],"exampleFix":"// before\nanySum({})\n// after\nanySum({\"values\": [1, 2, 3]})","handlingStrategy":"validation","validationCode":"m, ok := raw.(map[string]any); if !ok { return errors.New(\"input not an object\") }; if _, ok := m[\"values\"]; !ok { return errors.New(\"values is required\") }","typeGuard":"func hasValues(m map[string]any) bool { _, ok := m[\"values\"]; return ok }","tryCatchPattern":"out, err := tool.Call(input); if err != nil && strings.Contains(err.Error(), \"missing values\") { retryWithCorrection(err.Error()) }","preventionTips":["Name the parameter explicitly in prompts/tool descriptions so models use \"values\"","Keep required:[\"values\"] advertised in the schema sent to the model","Validate arguments client-side before dispatching the tool call"],"tags":["tool-input","missing-parameter","ai-tools"],"backgroundTag":"missing-required-argument","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}