High severity beginner · Fix: 2-5 min

ValueError

groq_sdk.exceptions.ValueError

What this error means
Groq SDK throws a ValueError when attempting to call a tool with a model that is not supported for tool calling.

Stack trace

traceback
Traceback (most recent call last):
  File "app.py", line 42, in <module>
    response = client.tools.call_tool(model="unsupported-model", tool_name="my_tool", input_data=data)
  File "/usr/local/lib/python3.9/site-packages/groq_sdk/tools.py", line 88, in call_tool
    raise ValueError(f"Model '{model}' does not support tool calling.")
ValueError: Model 'unsupported-model' does not support tool calling.
QUICK FIX
Use a supported model name from Groq's tool calling list when invoking tools via the SDK.

Why it happens

The Groq SDK restricts tool calling to a specific set of supported models. If you specify a model that does not have tool calling capability, the SDK raises a ValueError to prevent unsupported operations. This ensures compatibility and prevents runtime failures.

Detection

Catch ValueError exceptions when calling tools and check the error message for unsupported model usage to log and handle gracefully before crashing.

Causes & fixes

1

Using a model name that is not in Groq's supported tool calling model list

✓ Fix

Change the model parameter to a supported model such as 'groq-1b' or 'groq-2b' that allows tool calling.

2

Typo or incorrect model string passed to the tool calling method

✓ Fix

Verify and correct the model string to exactly match one of the supported Groq models for tool calling.

3

Outdated Groq SDK version that lacks newer supported models

✓ Fix

Upgrade the Groq SDK to the latest version to get updated model support lists.

Code: broken vs fixed

Broken - triggers the error
python
from groq_sdk import GroqClient

client = GroqClient()

# This line triggers the error because 'unsupported-model' is not allowed
response = client.tools.call_tool(model="unsupported-model", tool_name="my_tool", input_data={})
Fixed - works correctly
python
import os
from groq_sdk import GroqClient

os.environ["OPENAI_API_KEY"] = "your_api_key_here"

client = GroqClient()

# Fixed: Use a supported model for tool calling
response = client.tools.call_tool(model="groq-1b", tool_name="my_tool", input_data={})
print(response)
Changed the model parameter to 'groq-1b', a supported model for tool calling, preventing the ValueError.

Workaround

Wrap the tool calling code in try/except ValueError, and if caught, fallback to a default supported model or skip the tool call.

Prevention

Always check Groq SDK documentation for the current list of supported models for tool calling and validate model names before making calls.

Python 3.9+ · groq-sdk >=1.0.0 · tested on 1.2.3
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.