clockworklabs/SpacetimeDB · error · InvalidOperationException
Invalid HTTP method returned from host
Error message
Invalid HTTP method returned from host
What it means
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.
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
Defensive patterns
Strategy: try-catch
Try / catch
try { var method = FromWireResponse(responseWire); }
catch (InvalidOperationException ioe) when (ioe.Message.Contains("Invalid HTTP method"))
{
// unknown wire tag from the host: almost always host/bindings version skew.
// Abort the conversation with this host; upgrading bindings is the real fix.
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid HTTP version returned from host
- Cannot nest router at
- Pre-publish check failed with status
- Route conflict for
- Route paths may contain only
AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20).
Data as JSON: /api/errors/3d34c786e960badc.
Report an issue: GitHub.
Appendix: source
Thrown at crates/bindings-csharp/Runtime/Http.cs:470
Code = response.StatusCode,
},
response.Body.ToBytes()
);
private static HttpMethod FromWireMethod(HttpMethodWire methodWire) =>
methodWire switch
{
HttpMethodWire.Get => HttpMethod.Get,
HttpMethodWire.Head => HttpMethod.Head,
HttpMethodWire.Post => HttpMethod.Post,
HttpMethodWire.Put => HttpMethod.Put,
HttpMethodWire.Delete => HttpMethod.Delete,
HttpMethodWire.Connect => HttpMethod.Connect,
HttpMethodWire.Options => HttpMethod.Options,
HttpMethodWire.Trace => HttpMethod.Trace,
HttpMethodWire.Patch => HttpMethod.Patch,
HttpMethodWire.Extension(var extension) => new HttpMethod(extension),
_ => throw new InvalidOperationException("Invalid HTTP method returned from host"),
};
private static HttpVersion FromWireVersion(HttpVersionWire versionWire) =>
versionWire switch
{
HttpVersionWire.Http09 => HttpVersion.Http09,
HttpVersionWire.Http10 => HttpVersion.Http10,
HttpVersionWire.Http11 => HttpVersion.Http11,
HttpVersionWire.Http2 => HttpVersion.Http2,
HttpVersionWire.Http3 => HttpVersion.Http3,
_ => throw new InvalidOperationException("Invalid HTTP version returned from host"),
};
private static (
ushort statusCode,
HttpVersion version,
List<HttpHeader> headers
) FromWireResponse(HttpResponseWire responseWire)View on GitHub (pinned to 6dee26c6ef)