pub enum NegotiationError {
UnsupportedServerVersion {
answered: ProtocolVersion,
supported: String,
},
HeaderMismatch {
negotiated: ProtocolVersion,
header: String,
},
HeaderNotAVersion {
header: String,
},
MissingStatelessVersion {
version: ProtocolVersion,
},
}Expand description
Why negotiation could not produce a session.
Every variant is a case where answering with a fallback would be a guess about what the peer meant. Cases where a fallback is specified — an unknown version, a missing header — are not errors and do not appear here.
Variants§
UnsupportedServerVersion
The server answered with a revision this client cannot speak, and the client has no revision in common with it.
Fields
answered: ProtocolVersionWhat the server answered.
HeaderMismatch
A present MCP-Protocol-Version header disagrees with the negotiated
version.
A rejection rather than a reconciliation: a header that says one thing while the session says another is a client that has lost track, and picking either would be guessing.
Fields
negotiated: ProtocolVersionThe negotiated version.
HeaderNotAVersion
The MCP-Protocol-Version header was not a version this build knows.
MissingStatelessVersion
A stateless request carried no version in _meta, which 2026-07-28
requires.
This one has no fallback on purpose. The whole point of the stateless lifecycle is that every request is self-describing, so a request that is not has left the only signal the protocol provides.
Fields
version: ProtocolVersionThe lifecycle that demanded it.
Trait Implementations§
Source§impl Clone for NegotiationError
impl Clone for NegotiationError
Source§impl Debug for NegotiationError
impl Debug for NegotiationError
Source§impl Display for NegotiationError
impl Display for NegotiationError
impl Eq for NegotiationError
Source§impl Error for NegotiationError
impl Error for NegotiationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()