{"record":{"id":"460cc8520009e58b","repo":"pola-rs/polars","slug":"response-result","errorCode":null,"errorMessage":"response[\"result\"]","messagePattern":"response\\[\"result\"\\]","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/database/_cursor_proxies.py","lineNumber":99,"sourceCode":"    \"\"\"Cursor proxy for both SurrealDB and AsyncSurrealDB connections.\"\"\"\n\n    _cached_result: list[dict[str, Any]] | None = None\n\n    def __init__(self, client: Any) -> None:\n        surrealdb = import_optional(\"surrealdb\")\n        self.is_async = isinstance(client, surrealdb.AsyncSurrealDB)\n        self.execute_options: dict[str, Any] = {}\n        self.client = client\n        self.query: str = None  # type: ignore[assignment]\n\n    @staticmethod\n    async def _unpack_result_async(\n        result: Coroutine[Any, Any, list[dict[str, Any]]],\n    ) -> Coroutine[Any, Any, list[dict[str, Any]]]:\n        \"\"\"Unpack the async query result.\"\"\"\n        response = (await result)[0]\n        if response[\"status\"] != \"OK\":\n            raise RuntimeError(response[\"result\"])\n        return response[\"result\"]\n\n    @staticmethod\n    def _unpack_result(\n        result: list[dict[str, Any]],\n    ) -> list[dict[str, Any]]:\n        \"\"\"Unpack the query result.\"\"\"\n        response = result[0]\n        if response[\"status\"] != \"OK\":\n            raise RuntimeError(response[\"result\"])\n        return response[\"result\"]\n\n    def close(self) -> None:\n        \"\"\"Close the cursor.\"\"\"\n        # no-op; never close a user's Surreal session\n\n    def execute(self, query: str, **execute_options: Any) -> Self:\n        \"\"\"Execute a query (n/a: just store query for the fetch* methods).\"\"\"","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/py-polars/src/polars/io/database/_cursor_proxies.py#L81-L117","documentation":"Lookup key/label used inside the SurrealDB cursor proxy when unpacking query results: identifies the 'result' entry of the response payload returned by SurrealDB's query API. Appears where the proxy extracts rows from response[\"result\"], which may be missing or malformed if the SurrealDB server returns an error-shaped payload.","triggerScenarios":"Thrown at py-polars/src/polars/io/database/_cursor_proxies.py:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the database/driver response contains a 'result' key; check the query and driver compatibility before indexing response['result']."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}