{"record":{"id":"916a6da040dd0311","repo":"BerriAI/litellm","slug":"resolved-path-contains-invalid-or-unexpected-jso","errorCode":null,"errorMessage":"{resolved_path} contains invalid or unexpected JSON; cannot proceed safely.","messagePattern":"(.+?) contains invalid or unexpected JSON; cannot proceed safely\\.","errorType":"exception","errorClass":"UpError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/client/cli/commands/autoroute/process.py","lineNumber":133,"sourceCode":"    resolved_path.parent.mkdir(parents=True, exist_ok=True)\n    with open(resolved_path, \"w\") as f:\n        json.dump(\n            {\"pid\": record.pid, \"port\": record.port, \"config_path\": record.config_path, \"log_path\": record.log_path},\n            f,\n            indent=2,\n        )\n\n\ndef read_pid_record(path: Path | None = None) -> PidRecord | None:\n    resolved_path: Final = path if path is not None else PID_RECORD_PATH\n    if not resolved_path.exists():\n        return None\n    with open(resolved_path, \"r\") as f:\n        content: Final = f.read()\n    try:\n        return _PID_RECORD_ADAPTER.validate_json(content)\n    except ValidationError:\n        raise UpError(f\"{resolved_path} contains invalid or unexpected JSON; cannot proceed safely.\")\n\n\ndef clear_pid_record(path: Path | None = None) -> None:\n    resolved_path: Final = path if path is not None else PID_RECORD_PATH\n    resolved_path.unlink(missing_ok=True)\n\n\ndef is_running(pid: int) -> bool:\n    try:\n        os.kill(pid, 0)\n    except ProcessLookupError:\n        return False\n    except PermissionError:\n        return True\n    return True\n\n\ndef terminate(pid: int, grace_period: float = 5.0) -> None:","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/client/cli/commands/autoroute/process.py#L115-L151","documentation":"The autoroute PID record file exists but fails Pydantic validation or contains unexpected JSON, so a running ephemeral proxy cannot be safely identified or stopped; the command aborts rather than guessing.","triggerScenarios":"Thrown at litellm/proxy/client/cli/commands/autoroute/process.py:133 when the library encounters an invalid state.","commonSituations":"A CLI state/config file contains invalid or unexpected JSON.","solutions":["Fix the JSON in the referenced file so it parses as expected.","Restore the file from a known-good copy."],"exampleFix":"python -m json.tool <file> to validate the JSON.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}