`tool_call_id` truncation error during tool calling with Gemini models
- Dominant language
- Python
- Stars
- 69
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
**Title:** `tool_call_id` truncation error during tool calling with Gemini models
**Description:**
When using Google Gemini models (e.g., `gemini-2.5-flash`) for tool calling, the session crashes with a truncation error. Gemini generates significantly longer `tool_call_id` strings than OpenAI, which exceed Frappe's default 140-character limit for `Data` fields.
Because the database insert fails, the flow's state is marked as `Failed`, preventing it from being resumed.
**Steps to Reproduce:**
1. Configure a Google AI Studio / Gemini model in the Flow Model DocType.
2. Create a Flow Session and trigger a prompt that requires a tool/function call.
3. The session crashes when attempting to save the `Flow Session Message`.
**Error Log:**
`Error: Flow Session Message, Row 7: 'Tool Call ID' (call_a9efe2adc63948f48e20943b87cethoughtEl4KXAERTTIPeUBLJ5fdyJDdi++R1Hr1st/9pRsw+sCVQRSKxATqH4CnIHJaEqw0Vzo1EwwTQ6PYT3/VVfXXi2W+9a+gWaNFno/1WVc/x/ulbv1WYlZGMCIA8kJ0CwqG) will get truncated, as max characters allowed is 140`
`Error: Only Paused runs can be resumed (this run is Failed).`
**Expected Behavior:**
The system should accommodate longer Tool Call IDs from non-OpenAI providers to allow successful execution and state saving.
**Suggested Fix:**
In the `Flow Session Message` DocType, change the field type of `tool_call_id` from `Data` to `Small Text`, or increase the `Data` length property to 255+ to safely handle Gemini's verbose ID generation.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Flow Session Message DocType and inspect the tool_call_id field, currently described as a Data field with a 140-character limit. Reproduce a tool call using a Google Gemini model such as gemini-2.5-flash, then verify that the Flow Session Message saves successfully and the session is not marked Failed or prevented from resuming.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100