{"record":{"id":"9310e35a0eaf3cc4","repo":"hasura/graphql-engine","slug":"sessionerror-0","errorCode":null,"errorMessage":"SessionError: {0}","messagePattern":"SessionError: (.+?)","errorType":"exception","errorClass":"ConnectionInitError","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/graphql-ws/src/protocol/init.rs","lineNumber":128,"sourceCode":"                    }\n                })\n            },\n        )\n        .await\n}\n\n/// Error types that may occur during connection initialization.\n#[derive(Debug, thiserror::Error)]\npub enum ConnectionInitError {\n    #[error(\"Connection already initialized\")]\n    AlreadyInitialized,\n    #[error(\"Invalid header name: {0}\")]\n    InvalidHeaderName(#[from] http::header::InvalidHeaderName),\n    #[error(\"Invalid header value: {0}\")]\n    InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),\n    #[error(\"AuthError: {0}\")]\n    Authn(#[from] AuthError),\n    #[error(\"SessionError: {0}\")]\n    Session(#[from] SessionError),\n}\n\nimpl tracing_util::TraceableError for ConnectionInitError {\n    fn visibility(&self) -> tracing_util::ErrorVisibility {\n        tracing_util::ErrorVisibility::User\n    }\n}\n\n/// Parses headers from a given map of strings into an `http::HeaderMap`.\n/// Returns a parsed header map or an error if the headers are invalid.\nfn parse_headers(map: HashMap<String, String>) -> Result<http::HeaderMap, ConnectionInitError> {\n    let mut headers = http::HeaderMap::new();\n    for (key, value) in map {\n        let header_name = http::HeaderName::from_bytes(key.as_bytes())?;\n        let header_value = http::HeaderValue::from_str(&value)?;\n        headers.insert(header_name, header_value);\n    }","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/graphql-ws/src/protocol/init.rs#L110-L146","documentation":"This wraps a `SessionError` raised while handling a `connection_init` message, meaning session creation or validation failed during connection setup. The graphql-ws layer delegates session establishment to a session subsystem and surfaces its failures through `ConnectionInitError::Session`.","triggerScenarios":"The connection-init flow attempts to create or attach to a session and the session layer fails — e.g. session store unavailable, invalid session parameters in the payload, or session limits exceeded.","commonSituations":"Session store (e.g. Redis or in-memory store) down or unreachable; too many concurrent sessions hitting a configured cap; session-related payload parameters malformed after a protocol version change.","solutions":["Check the health/connectivity of the session store backing the connection","Inspect the connection_init payload for session-related parameters and correct them","Look for and raise session concurrency limits if the server reports exhaustion","Check server logs for the underlying SessionError variant for a precise cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (e) { if (String(e).startsWith('SessionError:')) { await delay(backoff()); reconnect(); } }","preventionTips":["Monitor session store health","Close sessions cleanly on disconnect to avoid leaks","Cap concurrent sessions per client below server limits"],"tags":["graphql-ws","session","websocket","connection-init"],"backgroundTag":"session-creation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}