{"record":{"id":"b0d43b26399f93aa","repo":"tursodatabase/turso","slug":"unsupported-value-type-in-server-response-typ-r","errorCode":null,"errorMessage":"unsupported value type in server response: {typ!r}","messagePattern":"unsupported value type in server response: (.+?)","errorType":"exception","errorClass":"ProtocolError","httpStatus":null,"severity":"error","filePath":"serverless/python/turso_serverless/protocol.py","lineNumber":76,"sourceCode":"            return None\n        if typ == \"integer\":\n            return int(pv[\"value\"])\n        if typ == \"float\":\n            raw = pv[\"value\"]\n            # A null value encodes a non-finite float (section 8.2); the\n            # spec says to decode it as NaN.\n            if raw is None:\n                return math.nan\n            return float(raw)\n        if typ == \"text\":\n            return pv[\"value\"]\n        if typ == \"blob\":\n            # The server may omit base64 padding (section 8).\n            b64 = pv[\"base64\"]\n            return base64.b64decode(b64 + \"=\" * (-len(b64) % 4))\n    except (KeyError, TypeError, ValueError) as e:\n        raise ProtocolError(f\"invalid value in server response: {e}\") from None\n    raise ProtocolError(f\"unsupported value type in server response: {typ!r}\")\n\n\ndef build_batch_step(\n    sql: str,\n    args: Optional[list] = None,\n    named_args: Optional[list[tuple[str, Any]]] = None,\n    want_rows: bool = True,\n    condition: Optional[dict] = None,\n) -> dict:\n    \"\"\"Build a batch step for a cursor request (section 7).\"\"\"\n    encoded_args = [encode_value(a) for a in args] if args else []\n    encoded_named = (\n        [{\"name\": name, \"value\": encode_value(val)} for name, val in named_args]\n        if named_args\n        else []\n    )\n    step: dict = {\n        \"stmt\": {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/serverless/python/turso_serverless/protocol.py#L58-L94","documentation":"decode_value() dispatches on the value's 'type' string and understands exactly five kinds: null, integer, float, text, and blob. A well-formed dict whose type is anything else falls past the if-chain to ProtocolError('unsupported value type in server response: ...'). Unlike the malformed-value error, this one means the JSON parsed fine but the client does not know this value type.","triggerScenarios":"A newer server adds a value kind (for example a JSON type) that this client version does not know; an alternative server implementation extending the protocol with extra types.","commonSituations":"Server upgraded ahead of the client; canary deployments with mixed versions; third-party Hrana-compatible servers using extensions.","solutions":["Upgrade the turso_serverless client so it knows the new value type","Pin client and server to a version pair you have tested together","If you control the server, restrict stored values to the five core types"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from turso_serverless.protocol import ProtocolError\n\ntry:\n    value = conn.execute(sql).fetchone()\nexcept ProtocolError as e:\n    if \"unsupported value type in server response\" in str(e):\n        log.error(\"client too old for this server's value types; upgrade turso_serverless\")\n        raise\n    raise","preventionTips":["Upgrade the client right after any server upgrade","Pin compatible client/server versions in deployment manifests","Restrict stored values to null/integer/float/text/blob if clients vary in version"],"tags":["python","protocol","server-response","version-skew"],"backgroundTag":"protocol-decode-error","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}