{"record":{"id":"fdd22a248c50e2ef","repo":"warpdotdev/warp","slug":"role-settings-unavailable-or-invalid","errorCode":"{role}_settings_unavailable_or_invalid","errorMessage":"{role}_settings_unavailable_or_invalid","messagePattern":"(.+?)_settings_unavailable_or_invalid","errorType":"exception","errorClass":"InspectionError","httpStatus":null,"severity":"error","filePath":"resources/bundled/skills/tui-migrate-setup/scripts/inspect_shared_settings.py","lineNumber":133,"sourceCode":"\n\ndef _read_toml_object(\n    path: Path,\n    paths: list[tuple[str, ...]],\n    *,\n    missing_ok: bool,\n    role: str,\n) -> dict[str, Any]:\n    if path.is_symlink():\n        raise InspectionError(\"settings_symlink_rejected\")\n    if missing_ok and not path.exists():\n        return {}\n    try:\n        contents = path.read_text(encoding=\"utf-8\")\n        selected = _select_relevant_toml(contents, paths)\n        value = tomllib.loads(selected) if selected else {}\n    except (OSError, tomllib.TOMLDecodeError) as error:\n        raise InspectionError(f\"{role}_settings_unavailable_or_invalid\") from error\n    if not isinstance(value, dict):\n        raise InspectionError(f\"{role}_settings_unavailable_or_invalid\")\n    return value\n\n\ndef inspect_settings(\n    schema: dict[str, Any],\n    source: dict[str, Any],\n    destination: dict[str, Any],\n) -> dict[str, Any]:\n    settings: list[dict[str, Any]] = []\n    for path in shared_setting_paths(schema):\n        source_present, source_value = nested_value(source, path)\n        if not source_present:\n            continue\n\n        destination_present, destination_value = nested_value(destination, path)\n        if not destination_present:","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/resources/bundled/skills/tui-migrate-setup/scripts/inspect_shared_settings.py#L115-L151","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hand-edited settings.toml with a missing quote or unclosed table; partially written files after a crash; restrictive file permissions under a different user.","solutions":["Validate the file directly: python -c \"import tomllib; tomllib.load(open('FILE','rb'))\" and fix the reported line","If TOML validates but the script still fails, fix permissions (chmod u+r) or ownership","Restore from backup, or remove the broken file and let the app regenerate defaults, then re-run"],"exampleFix":"# before (settings.toml)\n[theme]\nname = \"Solarized Dark   # missing closing quote\n\n# after\n[theme]\nname = \"Solarized Dark\"","handlingStrategy":"try-catch","validationCode":"import tomllib\nfrom pathlib import Path\n\nfor p in (source_path, destination_path):\n    if p.exists():\n        tomllib.load(open(p, 'rb'))  # surfaces any TOML error before the script does","typeGuard":null,"tryCatchPattern":"result = subprocess.run([...inspect_shared_settings.py...], capture_output=True, text=True)\nif result.returncode == 1:\n    code = result.stderr.strip().removeprefix('error: ')\n    if code in ('source_settings_unavailable_or_invalid', 'destination_settings_unavailable_or_invalid'):\n        # point the user at the matching file to validate/repair\n        ...","preventionTips":["tomllib-validate both settings files before migration","Avoid hand-editing settings TOML without a syntax check","Keep backups so a broken file can be restored quickly"],"tags":["toml","settings","io","cli"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}