mem0ai/mem0 · error · ValueError

The timestamp parameter is not supported by the OSS Memory S

Error message

The timestamp parameter is not supported by the OSS Memory SDK.

What it means

Raised at the top of Memory.add() when the timestamp keyword is not None: temporal parameters like timestamp are hosted-platform-only and are deliberately rejected by the OSS SDK (via get_temporal_feature_error_message) rather than silently ignored. This fail-fast design prevents code that works on OSS from producing different memory timelines than intended on the platform. Any non-None value triggers it.

Source

Thrown at mem0/memory/main.py:818

            `search()` and `get_all()` scope queries via `filters={"user_id": "...", "agent_id": "...", "run_id": "..."}` —
            they reject top-level `user_id`/`agent_id`/`run_id` arguments. `add()` accepts them top-level, but passing
            the same arguments to `search()`/`get_all()` raises a `ValueError`; use the `filters` form there instead.


        Returns:
            dict: A dictionary containing the result of the memory addition operation, typically
                  including a list of memory items affected (added, updated) under a "results" key.
                  Example for v1.1+: `{"results": [{"id": "...", "memory": "...", "event": "ADD"}]}`

        Raises:
            Mem0ValidationError: If input validation fails (invalid memory_type, messages format, etc.).
            VectorStoreError: If vector store operations fail.
            EmbeddingError: If embedding generation fails.
            LLMError: If LLM operations fail.
            DatabaseError: If database operations fail.
        """
        if timestamp is not None:
            raise ValueError(get_temporal_feature_error_message("sync", "add", "timestamp"))

        normalized_expiration_date = _normalize_expiration_date(expiration_date)
        temporal_usage_notice = detect_temporal_usage_from_metadata(metadata)
        processed_metadata, effective_filters = _build_filters_and_metadata(
            user_id=user_id,
            agent_id=agent_id,
            run_id=run_id,
            input_metadata=metadata,
        )
        if normalized_expiration_date is not None:
            processed_metadata["expiration_date"] = normalized_expiration_date

        if memory_type is not None and memory_type != MemoryType.PROCEDURAL.value:
            raise Mem0ValidationError(
                message=f"Invalid 'memory_type'. Please pass {MemoryType.PROCEDURAL.value} to create procedural memories.",
                error_code="VALIDATION_002",
                details={"provided_type": memory_type, "valid_type": MemoryType.PROCEDURAL.value},
                suggestion=f"Use '{MemoryType.PROCEDURAL.value}' to create procedural memories."

View on GitHub (pinned to 001c235229)

Solutions

  1. Remove the timestamp argument when using the OSS Memory class.
  2. For historical backfills in OSS, record the original time in metadata (e.g. metadata={'occurred_at': ...}) and filter on it yourself.
  3. If timestamp semantics are required, use the hosted MemoryClient.
  4. Strip platform-only kwargs before forwarding: pass only messages, user_id/agent_id/run_id, metadata, expiration_date.

Example fix

# before
m.add("Met at conference", user_id="u1", timestamp="2026-01-15T09:00:00Z")

# after
m.add("Met at conference", user_id="u1", metadata={"occurred_at": "2026-01-15T09:00:00Z"})
Defensive patterns

Strategy: validation

Validate before calling

platform_only = {"timestamp", "reference_date"}
kwargs = {k: v for k, v in kwargs.items() if k not in platform_only}
m.add(messages, **kwargs)

Type guard

OSS_ADD_ALLOWED = {"messages", "user_id", "agent_id", "run_id", "metadata", "filters", "prompt", "memory_type", "expiration_date", "infer", "output_format"}
def is_oss_add_kwarg(k: str) -> bool:
    return k in OSS_ADD_ALLOWED

Prevention

When it happens

Trigger: m.add(messages, user_id='u1', timestamp=1771070000) or timestamp='2026-08-14T10:00:00Z' — backfilling memories with historical times; importing platform example code that includes timestamp; a wrapper that forwards **kwargs including timestamp unconditionally.

Common situations: Migrating platform code to self-hosted; trying to backdate memories during a data import; shared helper functions written for both clients that pass platform-only kwargs to the OSS Memory class.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/08173f808ca3997c. Report an issue: GitHub.