langchain-ai/deepagents · error · OSError

could not update {DEFAULT_CONFIG_PATH}

Error message

could not update {DEFAULT_CONFIG_PATH}

What it means

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.

Source

Thrown at libs/code/deepagents_code/update_check.py:4460

    Raises:
        OSError: If the user config cannot be updated atomically.
    """
    from deepagents_code.configuration.writer import update_user_config

    def mutate(data: dict[str, Any]) -> bool:
        section = data.get("update")
        if not isinstance(section, dict):
            section = {}
            data["update"] = section
        if section.get("auto_update") is enabled:
            return False
        section["auto_update"] = enabled
        return True

    result = update_user_config(mutate, config_path=DEFAULT_CONFIG_PATH)
    if not result.ok:
        raise OSError(result.error or f"could not update {DEFAULT_CONFIG_PATH}")


def is_auto_update_explicitly_set() -> bool:
    """Return whether an explicit auto-update preference is in force.

    `True` when managed policy decides the value, when
    `DEEPAGENTS_CODE_AUTO_UPDATE` holds a recognized boolean, or when
    `[update].auto_update` is present in `config.toml`. Distinguishes a
    deliberate opt-in/out from the implicit opt-out default.

    Managed policy counts: it is the most explicit preference there is, and
    omitting it made `should_announce_auto_update_default` tell the user that
    the implicit default was in force on a machine where an administrator had
    set the value.
    """
    from deepagents_code.configuration.resolver import (
        ENVIRONMENT_RANK,
        MANAGED_RANK,

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Read result.error / the OSError message for the underlying cause and fix it (permissions, disk space, syntax).
  2. Check permissions on the config file and its parent directory (ls -l, chown/chmod as needed).
  3. Validate or back up and regenerate the config file if it is corrupt.
  4. If managed policy controls the setting, update policy instead of user config.

Example fix

// before
set_auto_update(True)  # fails: config file owned by root
// after
sudo chown $USER ~/.config/deepagents_code/config.json
set_auto_update(True)
Defensive patterns

Strategy: try-catch

Validate before calling

import os
path = DEFAULT_CONFIG_PATH
if os.path.exists(path) and not os.access(path, os.W_OK):
    raise PermissionError(f'config not writable: {path}')

Try / catch

try:
    set_auto_update(True)
except OSError as e:
    logger.error('could not persist auto-update setting: %s', e)
    # fall back to env var or fix permissions and retry

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/e049da2c2b973903. Report an issue: GitHub.