You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/08/31 06:39:00 UTC

[jira] [Resolved] (CAMEL-24551) Expose structured error metadata (category, retry-after) as Exchange properties when an AI producer call fails

     [ https://issues.apache.org/jira/browse/CAMEL-24551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-24551.
---------------------------------
    Resolution: Fixed

> Expose structured error metadata (category, retry-after) as Exchange properties when an AI producer call fails
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24551
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24551
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-openai
>            Reporter: Claus Ibsen
>            Priority: Major
>             Fix For: 4.23.0
>
>
> When OpenAIProducer (and the equivalent langchain4j/spring-ai producers) catch a RuntimeException before rethrowing it for observability (e.g. OpenAIProducer.java ~714-738), they currently only call observation.recordError(e). Propose also setting a small set of Exchange properties derived from the underlying SDK exception, e.g.:
> - CamelAiErrorCategory (e.g. RATE_LIMIT, SERVER_ERROR, VALIDATION, AUTH, UNKNOWN) — classified from the SDK's typed exception hierarchy (RateLimitException, InternalServerException, UnprocessableEntityException, BadRequestException, UnauthorizedException).
> - CamelAiRetryAfterMillis — populated when available (e.g. from a 429's Retry-After header), so an onException handler can react without reaching into SDK-internal exception fields.
> This should live in the shared camel-ai-observability-api module (or a similarly shared camel-ai module) so all four producers (openai, langchain4j-chat/agent/embeddings, spring-ai-chat) get it consistently rather than duplicating logic. No behavior change to what's thrown — properties are additive, set right before the exception propagates.
> Related to CAMEL-24550 (documentation for targeted onException handling), which should reference these new properties once available.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)