github →

New request

#20877: Twenty AI fails with OpenAI Zero Data Retention: "Items are not persisted for Zero Data Retention organizations"

We'll provision a sandbox, run an agent against the issue, and open a draft PR. You can pull the branch and iterate from there.

Issue
sonarly:high

Summary

Twenty AI fails when using an OpenAI API key from an organization/project with Zero Data Retention enabled.

The AI chat returns: Failed to get response Item with id 'fc_0ca7d25a52784c2f016a1316f336988197a4a249c10a0b7f27' not found. Items are not persisted for Zero Data Retention organizations. Remove this item from your input and try again.

Environment

  • Twenty version: v2.7.3
  • Deployment: self-hosted Docker
  • OpenAI provider: OpenAI API key
  • OpenAI organization/project: Zero Data Retention enabled
  • Redis: local Docker Redis
  • Postgres: AWS RDS PostgreSQL

Steps to reproduce

  • Self-host Twenty.
  • Configure Twenty AI with an OpenAI API key from a Zero Data Retention organization/project.
  • Open AI chat in Twenty.
  • Send a prompt.
  • The request fails with the error below.

Actual behavior

Twenty returns: Failed to get response Item with id 'fc_...' not found. Items are not persisted for Zero Data Retention organizations. Remove this item from your input and try again.

Expected behavior

Twenty should either:

  • Support OpenAI Zero Data Retention organizations by using a stateless request flow that does not depend on persisted OpenAI item IDs; or
  • Detect this OpenAI error and show a clear message that OpenAI Zero Data Retention is currently unsupported.

Notes

The error appears to come from OpenAI because Zero Data Retention organizations do not persist items. It seems Twenty may be referencing a previously returned OpenAI item/tool-call ID in a later request.

Could Twenty AI avoid sending persisted item references when using OpenAI, or provide a configuration option for ZDR-compatible/stateless OpenAI requests?

Assessmentadvisory
bug●● medium80% confidence

OpenAI Zero Data Retention prevents item persistence, causing the AI chat flow to fail when it references previously stored OpenAI item IDs.

Likely files
  • packages/twenty-server/src/engine/core-modules/ai/ai.service.ts
  • packages/twenty-server/src/engine/core-modules/ai/ai-exception.filter.ts
  • packages/twenty-front/src/modules/ai/components/AIChat.tsx
  • packages/twenty-front/src/modules/ai/hooks/useAIChat.ts
  • packages/twenty-front/src/modules/ai/states/ai-chat-state.ts
Create the request

This opens a fresh agent run and a draft PR for issue #20877.

Cancel