juspay/hyperswitch · error
todo!()
Error message
todo!()
What it means
This is a Rust `todo!()` panic: the function `get_gateway_context` (or similar) in crates/router/src/core/payouts.rs is declared but intentionally unimplemented, so calling it panics with 'not yet implemented' at line 4222. It is a deliberate placeholder, not a runtime condition.
Solutions
- Implement the function body to construct and return the (RouterGatewayContext, SessionState) tuple
- If the flow is not meant to be reachable, return a typed RouterResult error instead of todo!() so callers fail gracefully
- Gate the call site behind a feature flag or config check until the implementation lands
Example fix
// before
) -> RouterResult<(gateway_context::RouterGatewayContext, SessionState)> {
todo!()
}
// after
) -> RouterResult<(gateway_context::RouterGatewayContext, SessionState)> {
let gateway_context = gateway_context::RouterGatewayContext { /* build from router_data */ };
let session_state = SessionState::new(header_payload, payout_data);
Ok((gateway_context, session_state))
} Defensive patterns
Strategy: validation
Validate before calling
if cfg!(feature = "payouts") && is_gateway_context_stubbed() { return Err(error_stack::report!(errors::PayoutsError::NotImplemented)); } Type guard
fn is_implemented(f: &dyn Fn() -> RouterResult<(RouterGatewayContext, SessionState)>) -> bool { !std::ptr::eq(f as *const _, &stub as *const _) } // prefer: feature-flag/config guard over runtime probing Try / catch
match result { Err(e) if e.is_not_implemented() => fallback_gateway_context(), other => other } Prevention
- Track all todo!() call sites with CI grep/lint gates
- Return typed NotImplemented errors instead of todo!() in library code
When it happens
Trigger: Any call into the payout gateway-context/session preparation path that reaches this stubbed function (e.g. executing a payout flow that requests the RouterGatewayContext + SessionState for a connector).
Common situations: Developers wiring up payout connector integration or calling core payout APIs in an in-progress refactor hit the panic at runtime; the crate compiles because todo!() type-checks as RouterResult.
Related errors
- todo!()
- a captured response must reconstruct
- authenticated redis settings failed validation
- Datatrans requires BodyKey auth type
- Etisalat requires SignatureKey auth type
AI-assisted analysis of juspay/hyperswitch@afd9284352 (2026-09-18).
Data as JSON: /api/errors/1bfc1cabf7d2fac3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/router/src/core/payouts.rs:4222
#[cfg(feature = "v2")]
{
None // V2 does not use feature metadata for gateway system tracking
}
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::type_complexity)]
#[instrument(skip_all)]
pub async fn decide_unified_connector_service_payout<F: Clone>(
state: &SessionState,
platform: &domain::Platform,
header_payload: HeaderPayload,
router_data: &types::RouterData<F, types::PayoutsData, types::PayoutsResponseData>,
connector_data: &api::ConnectorData,
payout_data: &mut PayoutData,
) -> RouterResult<(gateway_context::RouterGatewayContext, SessionState)> {
todo!()
}
/// Updates the payout intent's metadata to track the gateway system being used.
/// Merges gateway_system into the existing metadata map so merchant-provided fields are preserved.
#[cfg(feature = "v1")]
pub fn update_gateway_system_in_payout_metadata(
payout_data: &mut PayoutData,
gateway_system: common_enums::GatewaySystem,
) -> RouterResult<()> {
let gateway_system_metadata = FeatureMetadata {
gateway_system: Some(gateway_system),
..Default::default()
};
let gateway_system_metadata_value = serde_json::to_value(gateway_system_metadata)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to serialize gateway_system metadata")?;
View on GitHub (pinned to afd9284352)