{"record":{"id":"71acc1c5960b020d","repo":"tursodatabase/turso","slug":"remote-request-returned-unexpected-result-type-r","errorCode":null,"errorMessage":"Remote request returned unexpected result type: {result.Type}","messagePattern":"Remote request returned unexpected result type: (.+?)","errorType":"exception","errorClass":"TursoException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoRemoteClient.cs","lineNumber":237,"sourceCode":"            throw new TursoException(\"Remote request returned no results.\");\n\n        var result = response.Results[0];\n        RemoteStatementResult statementResult;\n        switch (result.Type)\n        {\n            case \"ok\":\n                if (result.Response is null)\n                    throw new TursoException(\"Remote request returned an empty ok response.\");\n                if (result.Response.Type != \"execute\")\n                    throw new TursoException($\"Remote request returned unexpected response type: {result.Response.Type}\");\n                statementResult = result.Response.DeserializeResult<RemoteStatementResult>();\n                break;\n\n            case \"error\":\n                throw CreateRemoteError(result.Error);\n\n            default:\n                throw new TursoException($\"Remote request returned unexpected result type: {result.Type}\");\n        }\n\n        ValidateOptionalTrailingClose(response, \"Remote request\");\n        return statementResult;\n    }\n\n    private static IReadOnlyList<RemoteStatementResult> ExtractBatchResults(RemotePipelineResponse response, int expectedCount)\n    {\n        if (response.Results.Count == 0)\n            throw new TursoException(\"Remote batch returned no results.\");\n\n        var result = response.Results[0];\n        List<RemoteStatementResult> statementResults;\n        switch (result.Type)\n        {\n            case \"ok\":\n                if (result.Response is null)\n                    throw new TursoException(\"Remote batch returned an empty ok response.\");","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoRemoteClient.cs#L219-L255","documentation":"The top-level pipeline result entry had a type the client does not recognize. ExtractExecuteResult only accepts \"ok\" and \"error\" for single-statement execution; anything else (a future result kind, a typo, or garbage from an intermediary) hits the default branch and throws.","triggerScenarios":"Remote statement execution where response.Results[0].Type is neither \"ok\" nor \"error\" -- for example a server or proxy injecting entries with another type string.","commonSituations":"A newer server introduces a new result type that the installed (older) bindings do not know; a middleware layer injects health-check or audit entries into the results array; a custom /v2/pipeline implementation emits nonstandard type strings.","solutions":["Capture the raw envelope and identify the unknown type string and which layer produced it.","If the server is newer than the bindings, upgrade the Turso.Data package to a release that supports the result type.","If an intermediary injects entries, remove it from the pipeline route.","If you operate the server, make it emit only ok/error entries as the protocol requires.","Report the unknown type to the bindings maintainers with the raw envelope."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await cmd.ExecuteNonQueryAsync(cancellationToken); }\ncatch (TursoException ex) when (ex.Message.Contains(\"unexpected result type\"))\n{\n    logger.LogError(ex, \"Unknown pipeline entry type for {Sql} -- likely version skew\", cmd.CommandText);\n    throw;\n}","preventionTips":["Upgrade the Turso.Data package whenever the server is upgraded; new entry types arrive with server releases.","Do not let middleware inject entries into pipeline response arrays.","If you run a custom server, emit only ok/error entries.","Track the raw type string from the message when reporting issues."],"tags":["turso","dotnet","remote","protocol","response-type"],"backgroundTag":"unexpected-response-type","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}