JuliusBrussee/caveman · error
tool call requires function type, id, function name, and JSO
Error message
tool call requires function type, id, function name, and JSON arguments
What it means
Error "tool call requires function type, id, function name, and JSON arguments" thrown in JuliusBrussee/caveman.
Source
Thrown at cacheengine/cachebench/corpus.go:375
}
if len(message.Content) > limits.MaxMessageBytes || (len(message.Content) > 0 && !json.Valid(message.Content)) {
return errors.New("content invalid or exceeds limit")
}
messageBytes := len(message.Content) + len(message.Role) + len(message.ToolCallID) + len(message.Name)
if len(message.Content) > 0 {
var content any
if err := json.Unmarshal(message.Content, &content); err != nil {
return errors.New("content must decode")
}
if content != nil {
if _, ok := content.(string); !ok {
return errors.New("content must be string or null")
}
}
}
for _, call := range message.ToolCalls {
if call.Type != "function" || !validBoundedText(call.ID, 2048, false) || !validBoundedText(call.Function.Name, 512, false) || !validUniqueJSONObject([]byte(call.Function.Arguments)) {
return errors.New("tool call requires function type, id, function name, and JSON arguments")
}
messageBytes += len(call.ID) + len(call.Type) + len(call.Function.Name) + len(call.Function.Arguments)
}
if messageBytes > limits.MaxMessageBytes {
return errors.New("message exceeds byte limit")
}
if message.Role == "tool" && message.ToolCallID == "" {
return errors.New("tool message requires tool_call_id")
}
return nil
}
func appendCorpusRow(rows *[]CorpusRow, sessions map[string]bool, retainedBytes *int64, row CorpusRow, limits CorpusLimits) error {
if len(*rows) >= limits.MaxRows {
return fmt.Errorf("row limit %d exceeded", limits.MaxRows)
}
if !sessions[row.SessionID] {
if len(sessions) >= limits.MaxSessions {View on GitHub (pinned to 27d5a3981a)
Solutions
- Give the tool call function type, id, function name, and JSON arguments.
When it happens
Trigger: Thrown at cacheengine/cachebench/corpus.go:375 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/7fe5b6ad8dc03c01.
Report an issue: GitHub.