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.
What happens
Measured on
mainat ad8ff24 throughPOST /api/v2/memories. None of these write anything, but each answers 500 rather than 422:timestamp"2026-01-01T12:00:00"(no offset)EpisodeEntryrefuses the naive datetime the request accepted1e20OSError: [Errno 84] Value too large to be stored in data type1e300OverflowError: timestamp out of range for platform time_tThe Python client sends a naive ISO string when given a naive
datetime: it assigns the value toMemoryMessage.timestampwithout validation (packages/client/src/memmachine_client/memory.py:247) and serializes it as2026-01-01T12:00:00.Why
datetimeUTC (packages/common/src/memmachine_common/api/spec.py:490-491) but returns a naive string's parse as it is (:501-503), andMemoryMessage.timestampaccepts a naive datetime (:466). The service then builds anEpisodeEntry, whosecreated_atmust be aware (packages/server/src/memmachine_server/common/episode_store/episode_model.py:35), and thatValidationErroris not a request validation error (packages/server/src/memmachine_server/server/api_v2/service.py:59-68).datetime.fromtimestampraisesOverflowErrororOSErrorfor 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
InvalidTimestampErrorfor these errors.🤖 Written by Claude Code (Claude Opus 5.5) on behalf of @edwinyyyu.