{"record":{"id":"3d34c786e960badc","repo":"clockworklabs/SpacetimeDB","slug":"invalid-http-method-returned-from-host","errorCode":null,"errorMessage":"Invalid HTTP method returned from host","messagePattern":"Invalid HTTP method returned from host","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"crates/bindings-csharp/Runtime/Http.cs","lineNumber":470,"sourceCode":"                Code = response.StatusCode,\n            },\n            response.Body.ToBytes()\n        );\n\n    private static HttpMethod FromWireMethod(HttpMethodWire methodWire) =>\n        methodWire switch\n        {\n            HttpMethodWire.Get => HttpMethod.Get,\n            HttpMethodWire.Head => HttpMethod.Head,\n            HttpMethodWire.Post => HttpMethod.Post,\n            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)","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings-csharp/Runtime/Http.cs#L452-L488","documentation":"Thrown by SpacetimeDB's module HTTP client when converting an HTTP method received from the host back into an HttpMethod. FromWireMethod exhaustively maps HttpMethodWire.Get/Head/Post/Put/Delete/Connect/Options/Trace/Patch and the Extension case; any other value falls to `_ =>` and throws. Since HttpMethodWire is a decoded BSATN tagged enum, an unknown value means the wire bytes carried a method tag this bindings version does not understand.","triggerScenarios":"The host returns an HTTP method whose wire tag is not one of the nine known variants — typically a newer spacetimedb host emitting a method encoding that older bindings cannot map, or a corrupted/truncated response stream that misdecodes the method tag.","commonSituations":"Server upgraded ahead of the module's NuGet packages (forward version skew); decoding a response where the reader position drifted (earlier field misparsed), making the method tag read garbage; custom or newly introduced HTTP methods on the host side.","solutions":["Update the SpacetimeDB bindings/runtime packages to the version matching the host","If versions already match, dump the raw response and check whether an earlier field was misparsed (reader position drift)","Reproduce with a plain GET/POST request to rule out exotic methods, and report a version-skew bug to SpacetimeDB with the payload"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var method = FromWireResponse(responseWire); }\ncatch (InvalidOperationException ioe) when (ioe.Message.Contains(\"Invalid HTTP method\"))\n{\n    // unknown wire tag from the host: almost always host/bindings version skew.\n    // Abort the conversation with this host; upgrading bindings is the real fix.\n}","preventionTips":["Pin host and module bindings to the same SpacetimeDB release train","Add a startup handshake/version check against the host before processing responses","Regression-test HTTP round-trips whenever either side is upgraded"],"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"}