Skip to content

ChatGPT import fails with KeyError 'create_time' on conversations missing that field #1276

Description

@phernandez

Summary

Importing ChatGPT conversations fails with Failed to import ChatGPT conversations: 'create_time' (a KeyError). Some conversations in current ChatGPT export archives lack a create_time field (or carry null), and the importer indexes the key unconditionally. In Basic Memory Cloud this surfaces as Import API returned 500 and the import job fails.

Evidence (from Basic Memory Cloud production)

RCA

  • Trigger: user imports a real ChatGPT export where at least one conversation has no usable create_time.
  • Root cause: the ChatGPT importer treats create_time as always present. OpenAI's export format does not guarantee it for every conversation object.
  • Impact: the whole import fails with a 500; the user gets none of their conversations.
  • Recovery: none; retrying the same archive fails identically.

Fix scope

  • Tolerate missing/null create_time (fall back to update_time, first message time, or epoch) and continue importing the remaining conversations; report per-conversation skips rather than failing the archive.
  • While in there: return a 4xx with a clear message for undecodable JSON instead of a 500.
  • Regression tests: conversation without create_time; conversation with create_time: null; malformed JSON archive.

Acceptance criteria

  • A ChatGPT export containing conversations without create_time imports successfully.
  • Cloud Logfire issue 1968 stops recurring for this cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions