Skip to content

Add-memories timestamps that are naive ISO strings or out-of-range Unix times answer 500 #1800

Description

@edwinyyyu

What happens

Measured on main at ad8ff24 through POST /api/v2/memories. None of these write anything, but each answers 500 rather than 422:

timestamp status error
"2026-01-01T12:00:00" (no offset) 500 EpisodeEntry refuses the naive datetime the request accepted
1e20 500 OSError: [Errno 84] Value too large to be stored in data type
1e300 500 OverflowError: timestamp out of range for platform time_t

The Python client sends a naive ISO string when given a naive datetime: it assigns the value to MemoryMessage.timestamp without validation (packages/client/src/memmachine_client/memory.py:247) and serializes it as 2026-01-01T12:00:00.

Why

  • The request's timestamp validator gives a naive datetime UTC (packages/common/src/memmachine_common/api/spec.py:490-491) but returns a naive string's parse as it is (:501-503), and MemoryMessage.timestamp accepts a naive datetime (:466). The service then builds an EpisodeEntry, whose created_at must be aware (packages/server/src/memmachine_server/common/episode_store/episode_model.py:35), and that ValidationError is not a request validation error (packages/server/src/memmachine_server/server/api_v2/service.py:59-68).
  • datetime.fromtimestamp raises OverflowError or OSError for an out-of-range Unix time (spec.py:498), which the validator does not turn into a validation error.

Expected

The request answers 422 for a timestamp it cannot use, or reads a naive string as UTC the way it reads a naive datetime.

Fix

Not in #1792. A naive string is a choice between refusing it and reading it as UTC; an out-of-range Unix time is refused by raising InvalidTimestampError for these errors.

🤖 Written by Claude Code (Claude Opus 5.5) on behalf of @edwinyyyu.

Activity

  1. added theissue type on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions