{"record":{"id":"5709c50f8eb5ad5d","repo":"clockworklabs/SpacetimeDB","slug":"invalid-http-version-returned-from-host","errorCode":null,"errorMessage":"Invalid HTTP version returned from host","messagePattern":"Invalid HTTP version returned from host","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"crates/bindings-csharp/Runtime/Http.cs","lineNumber":481,"sourceCode":"            HttpMethodWire.Put => HttpMethod.Put,\n            HttpMethodWire.Delete => HttpMethod.Delete,\n            HttpMethodWire.Connect => HttpMethod.Connect,\n            HttpMethodWire.Options => HttpMethod.Options,\n            HttpMethodWire.Trace => HttpMethod.Trace,\n            HttpMethodWire.Patch => HttpMethod.Patch,\n            HttpMethodWire.Extension(var extension) => new HttpMethod(extension),\n            _ => throw new InvalidOperationException(\"Invalid HTTP method returned from host\"),\n        };\n\n    private static HttpVersion FromWireVersion(HttpVersionWire versionWire) =>\n        versionWire switch\n        {\n            HttpVersionWire.Http09 => HttpVersion.Http09,\n            HttpVersionWire.Http10 => HttpVersion.Http10,\n            HttpVersionWire.Http11 => HttpVersion.Http11,\n            HttpVersionWire.Http2 => HttpVersion.Http2,\n            HttpVersionWire.Http3 => HttpVersion.Http3,\n            _ => throw new InvalidOperationException(\"Invalid HTTP version returned from host\"),\n        };\n\n    private static (\n        ushort statusCode,\n        HttpVersion version,\n        List<HttpHeader> headers\n    ) FromWireResponse(HttpResponseWire responseWire)\n    {\n        var version = FromWireVersion(responseWire.Version);\n\n        var headers = responseWire\n            .Headers.Entries.Select(h => new HttpHeader(h.Name, h.Value, false))\n            .ToList();\n\n        return (responseWire.Code, version, headers);\n    }\n}\n","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings-csharp/Runtime/Http.cs#L463-L499","documentation":"Companion of the HTTP-method check: FromWireVersion maps HttpVersionWire.Http09/Http10/Http11/Http2/Http3 and throws on anything else. The wire value comes straight from the host response; an unrecognized tag means the host's encoding and this bindings build disagree on the HttpVersionWire enum, or the byte stream is misaligned/corrupted.","triggerScenarios":"Host sends an HTTP version tag outside Http09..Http3 — newer host with an added version, or a misaligned BinaryReader (earlier field of the response decoded with the wrong size) making the version field read a bogus tag.","commonSituations":"Host/bindings version skew after a spacetimedb upgrade; schema drift in the HTTP wire types; stream corruption through a misbehaving proxy; unit tests replaying captured response bytes against a newer runtime.","solutions":["Match host and bindings versions (upgrade the SpacetimeDB packages to the server's release)","Validate the surrounding response fields decode correctly — a wrong earlier field size shifts the reader and corrupts the version tag","Log the raw bytes at the FFI boundary and file a SpacetimeDB issue if skew is confirmed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var version = FromWireVersion(responseWire.Version); }\ncatch (InvalidOperationException ioe) when (ioe.Message.Contains(\"Invalid HTTP version\"))\n{\n    // unrecognized wire enum: version skew or misaligned stream — stop parsing this response\n}","preventionTips":["Keep host and bindings versions aligned on upgrade","If mismatched decoding is suspected, verify earlier response fields parsed correctly before blaming the version tag","Capture raw FFI payloads in debug builds for quick skew diagnosis"],"tags":["csharp","http","ffi","wire-protocol","version-skew"],"backgroundTag":"unknown-wire-enum-value","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}