juspay/hyperswitch · error

Couldn't get GetRefundMetricRequest

Error message

Couldn't get GetRefundMetricRequest

What it means

Error "Couldn't get GetRefundMetricRequest" thrown in juspay/hyperswitch.

Source

Thrown at crates/router/src/analytics.rs:967

        ))
        .await
    }

    /// # Panics
    ///
    /// Panics if `json_payload` array does not contain one `GetRefundMetricRequest` element.
    pub async fn get_merchant_refund_metrics(
        state: web::Data<AppState>,
        req: actix_web::HttpRequest,
        json_payload: web::Json<[GetRefundMetricRequest; 1]>,
    ) -> impl Responder {
        #[allow(clippy::expect_used)]
        // safety: This shouldn't panic owing to the data type
        let payload = json_payload
            .into_inner()
            .to_vec()
            .pop()
            .expect("Couldn't get GetRefundMetricRequest");
        let flow = AnalyticsFlow::GetRefundsMetrics;
        Box::pin(api::server_wrap(
            flow,
            state,
            &req,
            payload,
            |state, auth: AuthenticationData, req, _| async move {
                let auth_info = auth.platform.to_merchant_level_auth_info();

                let validator_response = request_validator(
                    AnalyticsRequest {
                        refund: Some(req.clone()),
                        ..Default::default()
                    },
                    &state,
                )
                .await?;
                let ex_rates = validator_response;

View on GitHub (pinned to 705a321950)

Solutions

  1. Check that the analytics metrics feature is enabled and the request type is supported by the analytics provider
  2. Verify the metrics request construction parameters (merchant id, time range, filters)

When it happens

Trigger: Thrown at crates/router/src/analytics.rs:967 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of juspay/hyperswitch@705a321950 (2026-08-19). Data as JSON: /api/errors/4ce2da6e2fbc3338. Report an issue: GitHub.