warpdotdev/warp · error · InspectionError

{role}_settings_unavailable_or_invalid

{role}_settings_unavailable_or_invalid

Error message

{role}_settings_unavailable_or_invalid

What it means

Raised from _read_toml_object()'s except branch when reading or parsing a role-named settings TOML fails (OSError or tomllib.TOMLDecodeError); role is 'source' or 'destination' depending on which --source/--destination file broke, so the literal code is source_settings_unavailable_or_invalid or destination_settings_unavailable_or_invalid. Missing files are fine (missing_ok=True returns {}); this error means the file is present but unreadable or its relevant lines are not valid TOML.

Source

Thrown at resources/bundled/skills/tui-migrate-setup/scripts/inspect_shared_settings.py:133


def _read_toml_object(
    path: Path,
    paths: list[tuple[str, ...]],
    *,
    missing_ok: bool,
    role: str,
) -> dict[str, Any]:
    if path.is_symlink():
        raise InspectionError("settings_symlink_rejected")
    if missing_ok and not path.exists():
        return {}
    try:
        contents = path.read_text(encoding="utf-8")
        selected = _select_relevant_toml(contents, paths)
        value = tomllib.loads(selected) if selected else {}
    except (OSError, tomllib.TOMLDecodeError) as error:
        raise InspectionError(f"{role}_settings_unavailable_or_invalid") from error
    if not isinstance(value, dict):
        raise InspectionError(f"{role}_settings_unavailable_or_invalid")
    return value


def inspect_settings(
    schema: dict[str, Any],
    source: dict[str, Any],
    destination: dict[str, Any],
) -> dict[str, Any]:
    settings: list[dict[str, Any]] = []
    for path in shared_setting_paths(schema):
        source_present, source_value = nested_value(source, path)
        if not source_present:
            continue

        destination_present, destination_value = nested_value(destination, path)
        if not destination_present:

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Validate the file directly: python -c "import tomllib; tomllib.load(open('FILE','rb'))" and fix the reported line
  2. If TOML validates but the script still fails, fix permissions (chmod u+r) or ownership
  3. Restore from backup, or remove the broken file and let the app regenerate defaults, then re-run

Example fix

# before (settings.toml)
[theme]
name = "Solarized Dark   # missing closing quote

# after
[theme]
name = "Solarized Dark"
Defensive patterns

Strategy: try-catch

Validate before calling

import tomllib
from pathlib import Path

for p in (source_path, destination_path):
    if p.exists():
        tomllib.load(open(p, 'rb'))  # surfaces any TOML error before the script does

Try / catch

result = subprocess.run([...inspect_shared_settings.py...], capture_output=True, text=True)
if result.returncode == 1:
    code = result.stderr.strip().removeprefix('error: ')
    if code in ('source_settings_unavailable_or_invalid', 'destination_settings_unavailable_or_invalid'):
        # point the user at the matching file to validate/repair
        ...

Prevention

When it happens

Trigger: A syntax error inside a relevant setting block (the script extracts only lines for shared settings paths via _select_relevant_toml, so damage elsewhere may not trigger it); permission-denied on the file; encoding errors in the extracted region.

Common situations: Hand-edited settings.toml with a missing quote or unclosed table; partially written files after a crash; restrictive file permissions under a different user.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/fdd22a248c50e2ef. Report an issue: GitHub.