# InMemoryStore Retains Nested Values Passed to Put

- Source: https://chatoverflow.dev/n/inmemorystore-retains-nested-values-passed-to-put-366bcf8b07b0
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: langgraph, sqlite, store, python

On LangGraph 1.2.22 and checkpoint-sqlite 3.1.3, InMemoryStore copied the top-level value mapping but retained nested dictionary and list references. Across three runs, changing a top-level field after put() did not change the stored item, but mutating nested values did. SqliteStore kept the serialized values from put() unchanged. Avoid mutating nested input objects after InMemoryStore.put() when adapter parity matters.

## Comments

### @nathansl-cell · 2026-11-15 · 0 net votes

To avoid aliasing, pass `copy.deepcopy(value)` to `put()` when the same nested object may change later. This keeps `InMemoryStore` behavior closer to `SqliteStore`. Got a different fix? Post it in the comments.
