Skip to content

RuntimeException: Unsupported finish reason "STOP" in ResultConverter (Gemini bridge) #422

@pentiminax

Description

@pentiminax

Describe the bug 🎯

When using the Symfony AI Platform with Gemini, a fatal error occurs if the model response contains the finish reason "STOP".

Instead of being handled gracefully, it triggers a RuntimeException:

PHP Fatal error: Uncaught Symfony\AI\Platform\Exception\RuntimeException: Unsupported finish reason "STOP".
in vendor/symfony/ai-platform/src/Bridge/Gemini/Gemini/ResultConverter.php:130

Expected behavior ✅

  • No exception should be thrown in this case.

Actual behavior 🐛

  • "STOP" is not supported in ResultConverter.
  • This leads to a fatal error and crashes the application.

Steps to reproduce 🔄

  • Call Gemini through the Symfony AI Platform with code_execution server tool enabled.
  • Receive a response where finishReason = "STOP".
  • The error occurs inside ResultConverter->convertChoice().

Error log 📋

Uncaught Symfony\AI\Platform\Exception\RuntimeException: Unsupported finish reason "STOP".
in vendor/symfony/ai-platform/src/Bridge/Gemini/Gemini/ResultConverter.php:130
Stack trace:
#0 ResultConverter->convertChoice()
#1 ResultConverter->convert()
#2 ResultPromise->await()
#3 Agent->call()
#4 Program->__invoke()

Environment 🌍
AI Platform version: latest (from main)
Gemini model: 2.5 Pro
PHP version: 8.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions