{"record":{"id":"90ade0e7085f3651","repo":"tursodatabase/turso","slug":"remote-batch-did-not-return-a-result-for-step-i","errorCode":null,"errorMessage":"Remote batch did not return a result for step {i}.","messagePattern":"Remote batch did not return a result for step (.+?)\\.","errorType":"exception","errorClass":"TursoException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoRemoteClient.cs","lineNumber":315,"sourceCode":"    private static List<RemoteStatementResult> ExtractBatchStepResults(RemoteBatchResult batch, int expectedCount)\n    {\n        if (batch.StepErrors.Count != expectedCount || batch.StepResults.Count != expectedCount)\n        {\n            throw new TursoException(\n                $\"Remote batch returned an unexpected result shape: {batch.StepResults.Count} results, {batch.StepErrors.Count} errors, expected {expectedCount}.\");\n        }\n\n        for (var i = 0; i < batch.StepErrors.Count; i++)\n        {\n            if (batch.StepErrors[i] is { } error)\n                throw CreateRemoteError(error);\n        }\n\n        var statementResults = new List<RemoteStatementResult>(expectedCount);\n        for (var i = 0; i < batch.StepResults.Count; i++)\n        {\n            var stepResult = batch.StepResults[i]\n                             ?? throw new TursoException($\"Remote batch did not return a result for step {i}.\");\n            statementResults.Add(stepResult);\n        }\n\n        return statementResults;\n    }\n\n    private static void ValidateCloseResult(RemotePipelineResponse response)\n    {\n        foreach (var result in response.Results)\n        {\n            switch (result.Type)\n            {\n                case \"ok\":\n                    if (result.Response?.Type is not \"close\")\n                        throw new TursoException($\"Remote close returned unexpected response type: {result.Response?.Type}\");\n                    break;\n\n                case \"error\":","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoRemoteClient.cs#L297-L333","documentation":"Inside a batch result, a step had neither an error nor a result: step_errors[i] and step_results[i] were both null. The protocol requires exactly one of the two per step, so the server omitted the outcome for statement i.","triggerScenarios":"TursoBatch execution where the counts match but a specific step i has a null entry in step_results while its step_errors slot is also null.","commonSituations":"Server bugs that skip result materialization for certain statements (for example DDL or empty SQL inside a batch); schema drift between server and bindings; intermediaries nulling out fields.","solutions":["Identify which step index fails (the message includes i) and map it back to the TursoBatchCommand at that position; simplify that statement to find the trigger.","Run the failing statement as a standalone command to see whether it produces a normal result outside a batch.","Align server and bindings versions.","If it reproduces on current versions, report the batch and the missing step index."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return await batch.ExecuteReaderAsync(cancellationToken); }\ncatch (TursoException ex) when (ex.Message.Contains(\"did not return a result for step\"))\n{\n    logger.LogError(ex, \"Batch step missing a result; message names the step index\");\n    throw;\n}","preventionTips":["Map the failing step index from the message back to the TursoBatchCommand and simplify that statement to find the trigger.","Run suspicious statements standalone before putting them in batches.","Keep server and bindings versions aligned.","Report reproducible cases with the exact batch contents."],"tags":["turso","dotnet","remote","batch","protocol"],"backgroundTag":"missing-array-element","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}