{"record":{"id":"8ed85cbee3a40f06","repo":"tursodatabase/turso","slug":"unable-to-parse-remote-response-ex-message","errorCode":null,"errorMessage":"Unable to parse remote response: {ex.Message}","messagePattern":"Unable to parse remote response: (.+?)","errorType":"exception","errorClass":"TursoException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoRemoteClient.cs","lineNumber":162,"sourceCode":"        using var response = await _httpClient\n            .SendAsync(httpRequest, HttpCompletionOption.ResponseHeadersRead, effectiveCancellationToken)\n            .ConfigureAwait(false);\n\n        var body = await response.Content.ReadAsStringAsync(effectiveCancellationToken).ConfigureAwait(false);\n        if (!response.IsSuccessStatusCode)\n        {\n            throw new TursoException(\n                $\"Remote request failed with HTTP {(int)response.StatusCode} {response.ReasonPhrase}: {body}\");\n        }\n\n        try\n        {\n            return JsonSerializer.Deserialize<RemotePipelineResponse>(body, JsonOptions)\n                   ?? throw new TursoException(\"Remote request returned an empty response.\");\n        }\n        catch (JsonException ex)\n        {\n            throw new TursoException($\"Unable to parse remote response: {ex.Message}\");\n        }\n    }\n\n    private static CancellationTokenSource? CreateTimeout(int commandTimeout, CancellationToken cancellationToken)\n    {\n        if (commandTimeout <= 0)\n            return null;\n\n        var timeout = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);\n        timeout.CancelAfter(TimeSpan.FromSeconds(commandTimeout));\n        return timeout;\n    }\n\n    private static void ValidateAuthTokenTransport(Uri endpoint, string? authToken)\n    {\n        if (authToken is null\n            || endpoint.Scheme.Equals(Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)\n            || endpoint.IsLoopback)","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoRemoteClient.cs#L144-L180","documentation":"The HTTP call to /v2/pipeline returned a 2xx status, but the body could not be deserialized into the pipeline response envelope. System.Text.Json raised a JsonException, which TursoRemoteClient rethrows as a TursoException carrying the parser's message. The body is either not JSON at all (an HTML page, an empty string) or JSON whose shape does not match what the client expects (for example 'results' is not an array).","triggerScenarios":"Any remote Execute/Batch/Close call through TursoConnection with a remote Url where the 200-status body is an HTML login or redirect page, an empty string (empty input is itself invalid JSON), a truncated stream, or a JSON document with unexpected field names or types.","commonSituations":"A reverse proxy or CDN returns an HTML error/interstitial page with status 200; an HTTP-to-HTTPS redirect body; the Url points at a web app or docs portal instead of the database; the response is truncated by a buffering proxy or a read timeout; the server version emits a response schema the installed Turso.Data bindings cannot parse.","solutions":["Reproduce the exact request with curl against <Url>/v2/pipeline and look at the raw body: HTML means a routing problem, partial JSON means truncation, complete-but-different JSON means schema drift.","If the body is HTML, fix routing so the Url reaches the database pipeline endpoint, not a web server.","If the body is truncated JSON, check proxies, response buffering, size limits, and timeouts between client and server.","If the body is well-formed but differently shaped, align the server version and the Turso.Data package version.","Log the failing SQL and endpoint when this fires so you can correlate with server-side logs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    await using var reader = await cmd.ExecuteReaderAsync(cancellationToken);\n}\ncatch (TursoException ex) when (ex.Message.StartsWith(\"Unable to parse remote response\"))\n{\n    // 2xx + unparseable body: almost always routing/proxy, not data-dependent\n    logger.LogError(ex, \"Non-JSON body from {Url} while running {Sql}\", url, cmd.CommandText);\n    throw;\n}","preventionTips":["Smoke-test the pipeline endpoint with curl when setting up or changing the connection string.","Keep reverse proxies from rewriting or buffering database responses.","Pin matching versions of the server and the Turso.Data package.","Log SQL plus endpoint whenever a parse failure fires so the offending hop can be found fast."],"tags":["turso","dotnet","remote","json","deserialization","http"],"backgroundTag":"invalid-json-response","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}