warpdotdev/warp · error · InspectionError

schema_unavailable_or_invalid

schema_unavailable_or_invalid

Error message

schema_unavailable_or_invalid

What it means

inspect_shared_settings.py loads the JSON schema passed via --schema using _read_json_object(); this raise site is the except branch, firing when the file cannot be read or parsed (OSError, UnicodeError, json.JSONDecodeError). InspectionError keeps the message to a bare sanitized code so no file contents leak into output.

Source

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

    visit(schema, ())
    return sorted(paths)


def nested_value(document: dict[str, Any], path: tuple[str, ...]) -> tuple[bool, Any]:
    current: Any = document
    for segment in path:
        if not isinstance(current, dict) or segment not in current:
            return False, None
        current = current[segment]
    return True, current


def _read_json_object(path: Path) -> dict[str, Any]:
    try:
        value = json.loads(path.read_text(encoding="utf-8"))
    except (OSError, UnicodeError, json.JSONDecodeError) as error:
        raise InspectionError("schema_unavailable_or_invalid") from error
    if not isinstance(value, dict):
        raise InspectionError("schema_unavailable_or_invalid")
    return value


def _find_probe_path(
    value: Any, prefix: tuple[str, ...] = ()
) -> tuple[str, ...] | None:
    if isinstance(value, dict):
        if value.get("__warp_probe__") is True:
            return prefix
        for key, child in value.items():
            result = _find_probe_path(child, (*prefix, key))
            if result is not None:
                return result
    elif isinstance(value, list):
        for child in value:
            result = _find_probe_path(child, prefix)

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Verify the path and parse it yourself: python -c "import json,pathlib; json.loads(pathlib.Path('SCHEMA').read_text())"
  2. Regenerate or re-download the settings schema if it was truncated or hand-edited
  3. Check permissions/ownership when running under another user or a sandbox

Example fix

# before
python inspect_shared_settings.py --schema settings.schema.toml --source ... # wrong artifact
# error: schema_unavailable_or_invalid

# after
python inspect_shared_settings.py --schema settings.schema.json --source ... 
Defensive patterns

Strategy: validation

Validate before calling

import json
from pathlib import Path

schema = json.loads(Path(args.schema).read_text(encoding='utf-8'))  # raises the same classes the script catches
assert isinstance(schema, dict)

Type guard

def is_json_object(value) -> bool:
    return isinstance(value, dict)

Try / catch

result = subprocess.run([sys.executable, 'inspect_shared_settings.py', ...], capture_output=True, text=True)
if result.returncode != 0 and 'schema_unavailable_or_invalid' in result.stderr:
    # re-validate or regenerate the schema file, then retry once
    ...

Prevention

When it happens

Trigger: Passing --schema a path that is missing or unreadable; a schema with invalid JSON (trailing comma, comment, truncation); non-UTF-8 bytes; a TOML/JSONC file supplied where strict JSON is required.

Common situations: Typo'd or stale path after the schema moved; a schema emitted by another tool as JSONC with comments; permission-restricted file under a different user; empty file left by a failed earlier pipeline step.

Related errors


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