{"record":{"id":"cddc957bccf43289","repo":"langchain-ai/deepagents","slug":"skill-trust-store-store-path-is-not-a-json-objec","errorCode":null,"errorMessage":"Skill trust store {store_path} is not a JSON object","messagePattern":"Skill trust store (.+?) is not a JSON object","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/skills/trust.py","lineNumber":170,"sourceCode":"        # re-prompt, so log at WARNING (not DEBUG) to leave a breadcrumb for\n        # the otherwise-unexplained re-prompt.\n        logger.warning(\n            \"Skill trust store %s is corrupt; treating as empty: %s\", store_path, exc\n        )\n        return {}\n    except OSError as exc:\n        if strict:\n            raise\n        logger.warning(\n            \"Could not read skill trust store %s; treating as empty: %s\",\n            store_path,\n            exc,\n        )\n        return {}\n    if not isinstance(data, dict):\n        if strict:\n            msg = f\"Skill trust store {store_path} is not a JSON object\"\n            raise ValueError(msg)\n        logger.warning(\n            \"Skill trust store %s is not a JSON object; ignoring\", store_path\n        )\n        return {}\n    # A store written by a newer build may carry an incompatible schema. Reading\n    # its `dirs` regardless could misinterpret entries, so refuse: fail-closed\n    # (treat as nothing trusted) for enforcement, and surface the error for the\n    # audit path. A present-but-non-integer `version` is unrecognized in the same\n    # way (only tampering or a corrupt write produces it, since every writer\n    # stamps an int), so it is refused too rather than falling through and\n    # trusting `dirs`. A missing `version` stays tolerated: an empty `{}` file\n    # has no `dirs` to trust anyway. Together this makes the `_STORAGE_VERSION`\n    # \"bump on incompatible changes\" contract enforceable rather than\n    # aspirational.\n    version = data.get(\"version\")\n    if version is not None and (\n        not isinstance(version, int) or version > _STORAGE_VERSION\n    ):","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/skills/trust.py#L152-L188","documentation":"`_load_store` parses the skill trust store JSON. In strict mode, if the top-level JSON value is not an object (e.g. a list, string, or number), it raises `ValueError` with this message; in non-strict mode it logs a warning and treats the store as empty. Strict readers (like `skills trust list`) prefer failing loudly over silently ignoring a corrupt store.","triggerScenarios":"Calling `trust_skill_dir`, `revoke_skill_dir_trust`, or `_read_dirs` (which uses strict reads) when the trust store file contains valid JSON whose top level is an array or scalar instead of an object.","commonSituations":"Hand-editing the trust file and saving a bare list of paths; a tool rewriting the file in the wrong shape; truncated or mangled writes from a crash or disk-full leaving non-object content.","solutions":["Inspect the trust store file and fix its top level to be a JSON object of directory entries","Back up and delete the corrupt store so it is recreated empty, then re-trust directories with `skills trust add`","Avoid hand-editing the file; use the `skills trust` CLI subcommands","Check for writers (other tool versions) that may serialize the store in a different shape"],"exampleFix":"// before (trust.json)\n[\"/home/me/skills\"]\n// after\n{\"version\": 1, \"dirs\": {\"/home/me/skills\": {}}  # object shape expected by this build","handlingStrategy":"type-guard","validationCode":"import json\nfrom pathlib import Path\n\ndef store_is_object(store: Path) -> bool:\n    try:\n        return isinstance(json.loads(store.read_text(encoding='utf-8')), dict)\n    except (OSError, ValueError):\n        return False","typeGuard":"def is_trust_store_shape(data: object) -> bool:\n    return isinstance(data, dict)","tryCatchPattern":"try:\n    dirs = _read_dirs(store_path)  # strict read\nexcept ValueError as exc:\n    print(f'trust store corrupt ({exc}); recreating')\n    store_path.unlink(missing_ok=True)\n    dirs = {}","preventionTips":["Never hand-edit trust.json; use the CLI","Keep the top-level JSON shape an object","Back up and recreate the store if it was written by other tooling","Guard against concurrent writers corrupting the file"],"tags":["trust-store","json","schema-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}