Skip to content

from-segments endpoint 500s: CreateConversation object missing text_source attribute #6894

@beastoin

Description

@beastoin

Observed behavior

POST /v1/dev/user/conversations/from-segments returns HTTP 500 with a generic error message. Recurring in production.

Call path

routers/developer.py:1009 → creates CreateConversation(source=external_integration)
  └─ utils/conversations/process_conversation.py:643 → process_conversation()
      └─ process_conversation.py:103-140 → _get_structured()
          └─ accesses conversation.text_source   ← AttributeError

How it happens

  1. The endpoint creates a CreateConversation object (models/conversation.py:449) with source defaulting to ConversationSource.external_integration
  2. This is passed to process_conversation()_get_structured()
  3. _get_structured() at line 103-140 checks:
    if conversation.source == ConversationSource.external_integration:
        if conversation.text_source == ExternalIntegrationConversationSource.audio:
  4. CreateConversation does not have a text_source attribute — only ExternalIntegrationCreateConversation (models/conversation.py:481) has it
  5. The AttributeError is caught by a blanket exception handler at line 199 and returned as a generic HTTP 500

Key facts

  • CreateConversation (line 449) has: transcript_segments, source, language — no text_source
  • ExternalIntegrationCreateConversation (line 481) has: text, text_source, text_source_spec — no transcript_segments
  • These are two different Pydantic models for different conversation creation flows, but _get_structured() doesn't distinguish between them
  • The generic exception handler masks the real error — logs show "Error processing conversation" with no indication it's a type mismatch

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2Priority: Important (score 14-21)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions