{"record":{"id":"fdb0daeed045b0d1","repo":"hasura/graphql-engine","slug":"failed-to-convert-session-variable-variable-name-fdb0da","errorCode":null,"errorMessage":"Failed to convert session variable '{variable_name}': {error}","messagePattern":"Failed to convert session variable '(.+?)': (.+?)","errorType":"validation","errorClass":"BuildRequestError","httpStatus":null,"severity":"error","filePath":"v3/crates/plugins/pre-ndc-response-plugin/src/execute.rs","lineNumber":54,"sourceCode":"}\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(_, _)\n            | Error::UnexpectedStatusCode(_)\n            | Error::PluginInternalError { .. } => ErrorVisibility::User,","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plugins/pre-ndc-response-plugin/src/execute.rs#L36-L72","documentation":"A single named session variable could not be converted while preparing the pre-NDC-response plugin request; the variable name and the serde error are both included. The variable exists in the session but its value does not fit the target type in the hook wire format.","triggerScenarios":"A configured session variable's JSON value (object/array where a scalar is expected, or vice versa) fails conversion in build_request for the response hook.","commonSituations":"IdP changing a claim's type (string → array) after an update; stale plugin config referencing old claim names; nested objects forwarded where strings are expected.","solutions":["Inspect the named variable's value in the token/session and its expected type","Correct the claim shape in the IdP or update the plugin config","Drop the variable from forwarding if unused","Re-test after auth configuration changes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// check claim type matches the forwarded type\nassert!(matches!(claims.get(var), Some(Value::String(_))));","typeGuard":null,"tryCatchPattern":"if let Err(Error::SessionVariableConversionError { variable_name, error }) = res {\n    tracing::warn!(variable_name, ?error, \"variable conversion failed\");\n}","preventionTips":["Document each forwarded claim's expected type","Re-verify claim shapes after IdP migrations"],"tags":["rust","session","auth","serde","plugin"],"backgroundTag":"session-variable-conversion-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}