juspay/hyperswitch · error
Failed to serialize default
Error message
Failed to serialize default
What it means
Error "Failed to serialize default" thrown in juspay/hyperswitch.
Source
Thrown at crates/router/src/core/configs/dimension_config.rs:58
macro_rules! config {
// Object config variant (with object = true)
(
superposition_key = $key:ident,
output = $output:ty,
default = $default:expr,
object = true,
requires = $requirement:ty,
targeting_key = $targeting_type:ty
) => {
paste::paste! {
pub struct [<$key:camel>];
impl superposition::Config for [<$key:camel>] {
type Output = serde_json::Value;
type TargetingKey = $targeting_type;
const SUPERPOSITION_KEY: &'static str = superposition_consts::$key;
fn default_value() -> Self::Output {
serde_json::to_value(&$default).expect("Failed to serialize default")
}
}
impl $requirement {
pub async fn [<get_ $key:lower>](
&self,
storage: &dyn StorageInterface,
superposition_client: &superposition::SuperpositionClient,
targeting_key: Option<&$targeting_type>,
) -> $output {
// Fetch JSON and convert to $output using the conversion function
crate::core::configs::fetch_db_config_for_objects::<[<$key:camel>], $output>(
storage, superposition_client, self, targeting_key
).await
}
}
}
};View on GitHub (pinned to 3093f22cc4)
Solutions
- Ensure the default dimension config value is serializable (valid JSON) in configuration
When it happens
Trigger: Thrown at crates/router/src/core/configs/dimension_config.rs:58 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of juspay/hyperswitch@3093f22cc4 (2026-08-19).
Data as JSON: /api/errors/99961cc0e0f01fc9.
Report an issue: GitHub.