{"record":{"id":"e049da2c2b973903","repo":"langchain-ai/deepagents","slug":"could-not-update-default-config-path","errorCode":null,"errorMessage":"could not update {DEFAULT_CONFIG_PATH}","messagePattern":"could not update (.+?)","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/update_check.py","lineNumber":4460,"sourceCode":"\n    Raises:\n        OSError: If the user config cannot be updated atomically.\n    \"\"\"\n    from deepagents_code.configuration.writer import update_user_config\n\n    def mutate(data: dict[str, Any]) -> bool:\n        section = data.get(\"update\")\n        if not isinstance(section, dict):\n            section = {}\n            data[\"update\"] = section\n        if section.get(\"auto_update\") is enabled:\n            return False\n        section[\"auto_update\"] = enabled\n        return True\n\n    result = update_user_config(mutate, config_path=DEFAULT_CONFIG_PATH)\n    if not result.ok:\n        raise OSError(result.error or f\"could not update {DEFAULT_CONFIG_PATH}\")\n\n\ndef is_auto_update_explicitly_set() -> bool:\n    \"\"\"Return whether an explicit auto-update preference is in force.\n\n    `True` when managed policy decides the value, when\n    `DEEPAGENTS_CODE_AUTO_UPDATE` holds a recognized boolean, or when\n    `[update].auto_update` is present in `config.toml`. Distinguishes a\n    deliberate opt-in/out from the implicit opt-out default.\n\n    Managed policy counts: it is the most explicit preference there is, and\n    omitting it made `should_announce_auto_update_default` tell the user that\n    the implicit default was in force on a machine where an administrator had\n    set the value.\n    \"\"\"\n    from deepagents_code.configuration.resolver import (\n        ENVIRONMENT_RANK,\n        MANAGED_RANK,","sourceCodeStart":4442,"sourceCodeEnd":4478,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/update_check.py#L4442-L4478","documentation":"Raised as OSError when persisting the auto-update preference to the user config file failed. update_user_config returned a failure result, and the library surfaces its error text (or a generic fallback) since the config could not be written. The setting change did not take effect.","triggerScenarios":"Calling the enable/disable auto-update API (update_check.py, set_auto_update path) when the config file at DEFAULT_CONFIG_PATH is unwritable, missing parent directories, permission-locked, or corrupted/unparseable.","commonSituations":"Read-only home directory or disk; config file owned by another user (root) after a sudo install; JSON/YAML syntax errors preventing parse-update-rewrite; managed policy files conflicting with user config.","solutions":["Read result.error / the OSError message for the underlying cause and fix it (permissions, disk space, syntax).","Check permissions on the config file and its parent directory (ls -l, chown/chmod as needed).","Validate or back up and regenerate the config file if it is corrupt.","If managed policy controls the setting, update policy instead of user config."],"exampleFix":"// before\nset_auto_update(True)  # fails: config file owned by root\n// after\nsudo chown $USER ~/.config/deepagents_code/config.json\nset_auto_update(True)","handlingStrategy":"try-catch","validationCode":"import os\npath = DEFAULT_CONFIG_PATH\nif os.path.exists(path) and not os.access(path, os.W_OK):\n    raise PermissionError(f'config not writable: {path}')","typeGuard":null,"tryCatchPattern":"try:\n    set_auto_update(True)\nexcept OSError as e:\n    logger.error('could not persist auto-update setting: %s', e)\n    # fall back to env var or fix permissions and retry","preventionTips":["Ensure the config file and its parent dir are writable by the running user","Avoid running installers with sudo that create root-owned config files","Validate config file syntax before programmatic edits","Back up the config before bulk edits"],"tags":["filesystem","permissions","config","io"],"backgroundTag":"config-write-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}