{"record":{"id":"1a3a2bc385bb8bf7","repo":"hasura/graphql-engine","slug":"failed-to-convert-session-0","errorCode":null,"errorMessage":"Failed to convert session: {0}","messagePattern":"Failed to convert session: (.+?)","errorType":"validation","errorClass":"BuildRequestError","httpStatus":null,"severity":"error","filePath":"v3/crates/plugins/pre-ndc-request-plugin/src/execute.rs","lineNumber":52,"sourceCode":"        error: serde_json::Value,\n    },\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum BuildRequestError {\n    #[error(\"Invalid header name {header_name}: {error}\")]\n    InvalidHeaderName {\n        header_name: String,\n        #[source]\n        error: InvalidHeaderName,\n    },\n    #[error(\"Invalid header value for header {header_name}: {error}\")]\n    InvalidHeaderValue {\n        header_name: HeaderName,\n        #[source]\n        error: InvalidHeaderValue,\n    },\n    #[error(\"Failed to convert session: {0}\")]\n    SessionConversionError(String),\n    #[error(\"Failed to convert session variable '{variable_name}': {error}\")]\n    SessionVariableConversionError {\n        variable_name: SessionVariableName,\n        error: serde_json::Error,\n    },\n    #[error(\"Serialization error: {0}\")]\n    SerializationError(#[from] serde_json::Error),\n}\n\nimpl TraceableError for Error {\n    fn visibility(&self) -> ErrorVisibility {\n        match self {\n            Error::BuildRequestError(_, _) => ErrorVisibility::Internal,\n            Error::PluginUserError { .. }\n            | Error::ReqwestError(_)\n            | Error::PluginRequestParseError(_)\n            | Error::ErrorWhileMakingHTTPRequestToTheHook(_, _)","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plugins/pre-ndc-request-plugin/src/execute.rs#L34-L70","documentation":"The engine failed to convert the request's session/authorization object into the simplified map the pre-NDC-request plugin expects, and the string detail explains what part could not be converted. This happens during request building, before any HTTP call to the plugin. It usually stems from an authorization context shape the plugin conversion code does not handle.","triggerScenarios":"Calling a query with an auth session whose claims/roles structure cannot be mapped to the plugin's session representation, producing Error::SessionConversionError(detail) in build_request.","commonSituations":"Switching authentication modes (anonymous → JWT) without updating plugin config; a JWT with unexpected claim nesting; a new role format introduced by an engine upgrade.","solutions":["Read the {0} detail string — it names the exact session field that failed","Compare the JWT claims your IdP issues against the session format the plugin expects","Test with a minimal token containing only standard claims to isolate the offending field","Update the plugin crate/engine together so session conversion stays in sync"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(Error::SessionConversionError(detail)) = res {\n    tracing::error!(detail, \"session conversion failed; check auth config\");\n}","preventionTips":["Test hook paths with both anonymous and authenticated sessions","Keep IdP claim shapes stable and documented"],"tags":["rust","session","auth","plugin","conversion"],"backgroundTag":"session-conversion-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}