{"record":{"id":"5a4ce4844407ef29","repo":"langchain-ai/deepagents","slug":"store-item-does-not-contain-valid-content-field-g","errorCode":null,"errorMessage":"Store item does not contain valid content field. Got: {store_item.value.keys()}","messagePattern":"Store item does not contain valid content field\\. Got: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/backends/store.py","lineNumber":188,"sourceCode":"    def _convert_store_item_to_file_data(self, store_item: Item) -> FileData:\n        \"\"\"Convert current and legacy persisted store content to `FileData`.\n\n        Args:\n            store_item: The store `Item` containing file data.\n\n        Returns:\n            `FileData` with string content and encoding. Legacy `list[str]`\n                content is joined without modifying the persisted item. Includes\n                `created_at` and `modified_at` when present.\n\n        Raises:\n            ValueError: If the store item has no content.\n            TypeError: If content is neither a string nor a legacy list of strings.\n        \"\"\"\n        raw_content = store_item.value.get(\"content\")\n        if raw_content is None:\n            msg = f\"Store item does not contain valid content field. Got: {store_item.value.keys()}\"\n            raise ValueError(msg)\n\n        if isinstance(raw_content, list) and all(isinstance(line, str) for line in raw_content):\n            content = \"\\n\".join(raw_content)\n        elif isinstance(raw_content, str):\n            content = raw_content\n        else:\n            msg = f\"Store item `content` must be a `str` or legacy `list[str]`, got {type(raw_content).__name__}.\"\n            raise TypeError(msg)\n\n        result = FileData(\n            content=content,\n            encoding=store_item.value.get(\"encoding\", \"utf-8\"),\n        )\n        if \"created_at\" in store_item.value and isinstance(store_item.value[\"created_at\"], str):\n            result[\"created_at\"] = store_item.value[\"created_at\"]\n        if \"modified_at\" in store_item.value and isinstance(store_item.value[\"modified_at\"], str):\n            result[\"modified_at\"] = store_item.value[\"modified_at\"]\n        return result","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/backends/store.py#L170-L206","documentation":"When converting a persisted BaseStore item into `FileData`, `_convert_store_item_to_file_data` expects a `content` key in the item's value. If `value.get('content')` is None (missing or explicitly None), the item is considered corrupt/incompatible and a ValueError is raised listing the keys that were actually present.","triggerScenarios":"Reading store items written by other code that used a different value schema (no `content` key); store entries manually deleted/partially written; deserializing items from a different backend or an older/custom writer that stored content under a different key.","commonSituations":"Upgrading from a custom store writer to StoreBackend; sharing one BaseStore between multiple apps with conflicting schemas; hand-seeding an InMemoryStore in tests with items lacking `content`.","solutions":["Ensure every store item written includes a `content` key (str or list[str]) under `value`","Migrate or delete legacy store entries that lack `content` before reading them through StoreBackend","Filter store search results to items your app wrote (e.g. include a `kind` marker in value and skip others)","Inspect the reported keys in the message to find which schema the item actually uses"],"exampleFix":"// before\nstore.put(('filesystem',), '/a.txt', {'text': 'hello'})\n// after\nstore.put(('filesystem',), '/a.txt', {'content': 'hello'})","handlingStrategy":"validation","validationCode":"def writable_value(content, encoding='utf-8'):\n    if content is None:\n        raise ValueError('content is required')\n    if isinstance(content, str) or (isinstance(content, list) and all(isinstance(l, str) for l in content)):\n        return {'content': content, 'encoding': encoding}\n    raise TypeError(f'unsupported content: {type(content).__name__}')\nstore.put(('filesystem',), '/a.txt', writable_value('hello'))","typeGuard":"def has_content(value: dict) -> bool:\n    c = value.get('content')\n    return c is not None and (\n        isinstance(c, str)\n        or (isinstance(c, list) and all(isinstance(l, str) for l in c))\n    )","tryCatchPattern":"try:\n    data = backend.read('/a.txt')\nexcept ValueError as exc:\n    if 'does not contain valid content field' in str(exc):\n        data = None  # skip/migrate the corrupt store item\n    else:\n        raise","preventionTips":["Always include a `content` key when putting items into the store","Share a single write helper so all writers use the same value schema","Migrate or delete legacy entries lacking `content` before reading","Tag items with a schema/version key and skip foreign entries in searches"],"tags":["store","schema","data-corruption"],"backgroundTag":"schema-validation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}