tursodatabase/turso · error · TursoException

Remote batch returned no results.

Error message

Remote batch returned no results.

What it means

The batch counterpart of the empty-results check: ExecuteBatchAsync sent a one-request pipeline containing a batch, the response parsed, but the results array was empty. Every pipeline request must be answered with at least one result entry, so this is a malformed reply from the server or an intermediary.

Source

Thrown at bindings/dotnet/src/Turso.Data/TursoRemoteClient.cs:247

                    throw new TursoException($"Remote request returned unexpected response type: {result.Response.Type}");
                statementResult = result.Response.DeserializeResult<RemoteStatementResult>();
                break;

            case "error":
                throw CreateRemoteError(result.Error);

            default:
                throw new TursoException($"Remote request returned unexpected result type: {result.Type}");
        }

        ValidateOptionalTrailingClose(response, "Remote request");
        return statementResult;
    }

    private static IReadOnlyList<RemoteStatementResult> ExtractBatchResults(RemotePipelineResponse response, int expectedCount)
    {
        if (response.Results.Count == 0)
            throw new TursoException("Remote batch returned no results.");

        var result = response.Results[0];
        List<RemoteStatementResult> statementResults;
        switch (result.Type)
        {
            case "ok":
                if (result.Response is null)
                    throw new TursoException("Remote batch returned an empty ok response.");
                if (result.Response.Type != "batch")
                    throw new TursoException($"Remote batch returned unexpected response type: {result.Response.Type}");

                var batch = result.Response.DeserializeResult<RemoteBatchResult>();
                statementResults = ExtractBatchStepResults(batch, expectedCount);
                break;

            case "error":
                throw CreateRemoteError(result.Error);

View on GitHub (pinned to 244cde92a7)

Solutions

  1. Reproduce the batch pipeline POST with curl and inspect the raw envelope.
  2. Align server and Turso.Data binding versions, upgrading the older side.
  3. As a diagnostic, run the same statements as individual commands to confirm non-batch execution works.
  4. Remove JSON-rewriting proxies from the path.
  5. Report with the raw request and envelope if it reproduces on current versions.
Defensive patterns

Strategy: try-catch

Try / catch

try { return await batch.ExecuteNonQueryAsync(cancellationToken); }
catch (TursoException ex) when (ex.Message.Contains("Remote batch returned no results"))
{
    logger.LogError(ex, "Empty envelope for batch of {Count} commands", batch.BatchCommands.Count);
    throw;
}

Prevention

When it happens

Trigger: Executing a TursoBatch (with at least one TursoBatchCommand) against a remote-URL connection: ExecuteBatchAsync -> ExtractBatchResults finds response.Results.Count == 0.

Common situations: Version mismatch where the server does not implement batch requests and returns an empty envelope; gateways that rebuild response JSON and drop the results field; server bugs specific to batch handling.

Related errors


AI-assisted analysis of tursodatabase/turso@244cde92a7 (2026-08-20). Data as JSON: /api/errors/a75458c8efd86463. Report an issue: GitHub.