{"record":{"id":"dbd9ad96f8d2837e","repo":"juspay/hyperswitch","slug":"webhook-access-token-error","errorCode":"WEBHOOK_ACCESS_TOKEN_ERROR","errorMessage":"Failed to obtain access token for webhook registration","messagePattern":"Failed to obtain access token for webhook registration","errorType":"error_code","errorClass":"ErrorResponse","httpStatus":500,"severity":"error","filePath":"crates/router/src/core/merchant_connector_webhook_management.rs","lineNumber":44,"sourceCode":"use crate::{\n    consts,\n    core::{\n        errors::{self, ConnectorErrorExt, RouterResponse, StorageErrorExt},\n        payments::helpers,\n        utils as core_utils,\n    },\n    routes::{metrics, SessionState},\n    services::{\n        self,\n        api::{self as service_api},\n    },\n    types::{self, api, domain},\n};\n\nfn to_error_response<E: std::fmt::Display>(err: E) -> types::ErrorResponse {\n    router_env::logger::error!(error=%err, \"Webhook access token error\");\n    types::ErrorResponse {\n        code: \"WEBHOOK_ACCESS_TOKEN_ERROR\".to_string(),\n        message: \"Failed to obtain access token for webhook registration\".to_string(),\n        status_code: 500,\n        attempt_status: None,\n        connector_transaction_id: None,\n        connector_response_reference_id: None,\n        reason: Some(err.to_string()),\n        network_advice_code: None,\n        network_decline_code: None,\n        network_error_message: None,\n        connector_metadata: None,\n    }\n}\n\nasync fn fetch_access_token_for_webhook(\n    state: &SessionState,\n    connector_data: &api::ConnectorData,\n    router_data: &types::RouterData<\n        api::ConnectorWebhookRegister,","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/juspay/hyperswitch/blob/705a3219504c3cf9034e71d956455f8834ea4e64/crates/router/src/core/merchant_connector_webhook_management.rs#L26-L62","documentation":"Error \"Failed to obtain access token for webhook registration\" thrown in juspay/hyperswitch.","triggerScenarios":"Thrown at crates/router/src/core/merchant_connector_webhook_management.rs:44 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the connector credentials (client id/secret) used for webhook registration are valid and not expired","Check network connectivity to the connector token endpoint and inspect the token error response"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"705a3219504c3cf9034e71d956455f8834ea4e64","analyzedAt":"2026-08-19T10:36:43.745Z","contentChangedAt":"2026-08-19T10:36:43.745Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}