{"record":{"id":"61e13c4cda8e315d","repo":"hasura/graphql-engine","slug":"failed-to-convert-session-0-61e13c","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-response-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-response-plugin/src/execute.rs#L34-L70","documentation":"The engine could not convert the request's session/authorization object into the session representation sent to the pre-NDC-response plugin; the string detail says what failed. This occurs while building the outbound hook request, before any network call. It reflects an auth/session shape the conversion code does not handle.","triggerScenarios":"A request with an auth session whose claims structure cannot map to the plugin session format, raising SessionConversionError(detail) in the response-hook path.","commonSituations":"Changed auth mode or IdP claim layout without updating plugin config; anonymous requests hitting a hook that expects authenticated sessions; engine upgrade changing role serialization.","solutions":["Read the detail string to identify the failing session field","Align IdP claims / auth config with the session format the plugin expects","Test with a minimal standard JWT to isolate the problematic claim","Deploy engine and plugin versions together"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(Error::SessionConversionError(detail)) = res {\n    tracing::error!(detail, \"session conversion failed in response hook\");\n}","preventionTips":["Exercise response hooks with authenticated and anonymous requests in tests","Keep auth claim shapes stable"],"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"}