pola-rs/polars · error · RuntimeError
response["result"]
Error message
response["result"]
What it means
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.
Source
Thrown at py-polars/src/polars/io/database/_cursor_proxies.py:99
"""Cursor proxy for both SurrealDB and AsyncSurrealDB connections."""
_cached_result: list[dict[str, Any]] | None = None
def __init__(self, client: Any) -> None:
surrealdb = import_optional("surrealdb")
self.is_async = isinstance(client, surrealdb.AsyncSurrealDB)
self.execute_options: dict[str, Any] = {}
self.client = client
self.query: str = None # type: ignore[assignment]
@staticmethod
async def _unpack_result_async(
result: Coroutine[Any, Any, list[dict[str, Any]]],
) -> Coroutine[Any, Any, list[dict[str, Any]]]:
"""Unpack the async query result."""
response = (await result)[0]
if response["status"] != "OK":
raise RuntimeError(response["result"])
return response["result"]
@staticmethod
def _unpack_result(
result: list[dict[str, Any]],
) -> list[dict[str, Any]]:
"""Unpack the query result."""
response = result[0]
if response["status"] != "OK":
raise RuntimeError(response["result"])
return response["result"]
def close(self) -> None:
"""Close the cursor."""
# no-op; never close a user's Surreal session
def execute(self, query: str, **execute_options: Any) -> Self:
"""Execute a query (n/a: just store query for the fetch* methods)."""View on GitHub (pinned to 68506541d2)
Solutions
- Ensure the database/driver response contains a 'result' key; check the query and driver compatibility before indexing response['result'].
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at py-polars/src/polars/io/database/_cursor_proxies.py:97 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19).
Data as JSON: /api/errors/460cc8520009e58b.
Report an issue: GitHub.