{"record":{"id":"0c740ca5da309bba","repo":"run-llama/llama_index","slug":"command-failed-command-result-stderr","errorCode":null,"errorMessage":"Command failed: {command}\n{result.stderr}","messagePattern":"Command failed: (.+?)\n(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"llama-dev/llama_dev/release/changelog.py","lineNumber":20,"sourceCode":"import re\nimport shlex\nimport subprocess\nfrom datetime import date\nfrom pathlib import Path\n\nimport click\n\nfrom llama_dev.utils import find_all_packages, get_changed_packages, load_pyproject\n\nCHANGELOG_PLACEHOLDER = \"<!--- generated changelog --->\"\n\n\ndef _run_command(command: str) -> str:\n    \"\"\"Helper to run a shell command and return the output.\"\"\"\n    args = shlex.split(command)\n    result = subprocess.run(args, capture_output=True, text=True)\n    if result.returncode != 0:\n        raise RuntimeError(f\"Command failed: {command}\\n{result.stderr}\")\n    return result.stdout.strip()\n\n\ndef _get_latest_tag() -> str:\n    \"\"\"Get the most recent tag with the form v1.2.3\"\"\"\n    return _run_command('git describe --tags --match \"v[0-9]*\" --abbrev=0')\n\n\ndef _get_pr_numbers(latest_tag: str) -> set[str]:\n    \"\"\"Get the list of PR numbers merged between `latest_tag` and HEAD\"\"\"\n    log_output = _run_command(f'git log {latest_tag}..HEAD --pretty=\"format:%H %s\"')\n    pr_numbers = set()\n    pr_pattern = re.compile(r\"\\(#(\\d+)\\)\")\n    for line in log_output.splitlines():\n        match = pr_pattern.search(line)\n        if match:\n            pr_numbers.add(match.group(1))\n","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-dev/llama_dev/release/changelog.py#L2-L38","documentation":"Async twin of the get_node type check: raised by BaseDocumentStore.aget_node when aget_document returns a non-None object that fails isinstance(doc, BaseNode). This means the docstore contains data under that id, but it deserialized to something other than a BaseNode — corrupted rows, raw dicts, or an incompatible schema from another library version or an external writer.","triggerScenarios":"Awaiting aget_node on an id whose stored payload is a plain dict or legacy-format record that json_to_doc/legacy_json_to_doc could not map to a known node type; a custom store whose aget_document bypasses llama-index deserialization; docstore JSON files shared between different llama-index major versions.","commonSituations":"Persisted storage reused after upgrading llama-index; multiple writers (some storing raw payloads) sharing a KV collection; typos in TYPE_KEY values when hand-editing persisted docstore JSON; mixing docstore collections between Document and node data.","solutions":["Check the raw stored payload: print(type(await docstore.aget_document(node_id, raise_error=False))) and inspect its '__type__' field.","Rewrite the offending entries as proper BaseNode objects through add_documents so they serialize via doc_to_dict.","Re-ingest source documents into a fresh docstore if the data is from an incompatible version.","Align all writers/readers to the same llama-index version so doc_type keys match the registry in utils.py."],"exampleFix":"# before\nobj = await docstore.aget_node(node_id)  # ValueError: Document ... is not a Node.\n\n# after\nobj = await docstore.aget_document(node_id, raise_error=False)\nif not isinstance(obj, BaseNode):\n    from llama_index.core.storage.docstore.utils import json_to_doc\n    obj = json_to_doc(obj) if isinstance(obj, dict) else None\n# then re-store obj via add_documents","handlingStrategy":"type-guard","validationCode":"doc = await docstore.aget_document(node_id, raise_error=False)\nif not isinstance(doc, BaseNode):\n    # avoid aget_node; repair the record first\n    ...","typeGuard":"from llama_index.core.schema import BaseNode\n\ndef is_valid_stored(doc) -> bool:\n    return isinstance(doc, BaseNode)","tryCatchPattern":"try:\n    node = await docstore.aget_node(node_id)\nexcept ValueError as e:\n    if \"not a Node\" in str(e):\n        # repair: deserialize raw payload and re-add\n        ...","preventionTips":["Use json_to_doc/legacy_json_to_doc in custom store deserialization.","Pin one llama-index version for all writers of a shared store.","Add a startup integrity check that samples stored docs and asserts BaseNode type."],"tags":["docstore","async","serialization","llama-index"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}