Files
twenty/packages
Sonarly Claude Code b6af8ec687 fix: catch unsupported provider-defined tools in Bedrock v2 compatibility mode
https://sonarly.com/issue/21774?type=bug

AI chat streaming fails completely for workspaces using Amazon Bedrock with newer Claude models (e.g., Claude Opus 4.6) because the `@ai-sdk/amazon-bedrock` SDK falls back to v2 specification compatibility mode, which does not support provider-defined tools like `webSearch_20250305()`.

Fix: Two files changed to fix the root cause:

1. **`chat-execution.service.ts`** — Wrapped the `getNativeWebSearchTools()` switch block in a try-catch. When provider-defined tools fail (e.g., Bedrock v2 compatibility mode doesn't support `webSearch_20250305()`), the method now logs a warning and returns empty tools instead of letting the error propagate into `streamText()` where it kills the entire stream with `NoOutputGeneratedError`. Chat proceeds normally without web search.

2. **`agent-model-config.service.ts`** — Applied the same defensive pattern to `getNativeModelTools()`, which creates provider-defined tools for workflow agent execution. Added a `Logger` instance (following the same pattern used across all other services in this module) and wrapped the switch block in try-catch with a warning log.

Both fixes preserve the existing behavior for providers that support these tools (Anthropic direct API, OpenAI) while gracefully degrading for providers in compatibility mode (Bedrock with newer models). The fix is minimal and doesn't change any interfaces or types.
2026-04-04 12:16:51 +00:00
..
2026-04-04 06:05:51 +00:00
2026-04-03 12:44:03 +00:00
2026-04-04 06:05:51 +00:00