juspay/hyperswitch · error · Error
Blocklist create rule failed with status: ${response.status}
Error message
Blocklist create rule failed with status: ${response.status} and message: ${response.body?.error?.message} What it means
Thrown by blocklistCreateRule when POST /blocklist (api-key auth, body type='card_bin', data=cardBin) responds non-200. On success the command asserts fingerprint_id === cardBin, data_kind === 'card_bin', and a non-null created_at; any failure status throws with the server's error message.
Source
Thrown at cypress-tests/cypress/support/commands.js:7734
"api-key": apiKey,
},
body: body,
failOnStatusCode: false,
}).then((response) => {
logRequestId(response.headers["x-request-id"]);
cy.wrap(response).then(() => {
if (response.status === 200) {
expect(response.body)
.to.have.property("fingerprint_id")
.to.equal(cardBin);
expect(response.body)
.to.have.property("data_kind")
.to.equal("card_bin");
expect(response.body).to.have.property("created_at").to.not.be.null;
globalState.set("blocklistRuleId", response.body.fingerprint_id);
} else {
throw new Error(
`Blocklist create rule failed with status: ${response.status} and message: ${response.body?.error?.message}`
);
}
});
});
}
);
Cypress.Commands.add("blocklistDeleteRule", (type, data, globalState) => {
const apiKey = globalState.get("apiKey");
const baseUrl = globalState.get("baseUrl");
const url = `${baseUrl}/blocklist`;
const body = {
type: type,
data: data,
};
View on GitHub (pinned to 9b8b89dc37)
Solutions
- Delete the rule first in a before hook: cy.blocklistDeleteRule('card_bin', cardBin, globalState) — it is idempotent when tolerated
- Verify globalState.get('apiKey') is the correct key for the target baseUrl
- Check x-request-id in server logs for the exact rejection reason
- Confirm the blocklist feature is enabled for the environment
Example fix
// before
before(() => {
cy.blocklistCreateRule(requestBody, cardBin, globalState);
});
// after
before(() => {
cy.blocklistDeleteRule('card_bin', cardBin, globalState); // clear stale rule
cy.blocklistCreateRule(requestBody, cardBin, globalState);
}); Defensive patterns
Strategy: validation
Validate before calling
// make creation idempotent: clear any stale rule first
cy.blocklistDeleteRule('card_bin', cardBin, globalState);
cy.blocklistCreateRule(requestBody, cardBin, globalState); Try / catch
cy.wrap(null)
.then(() => cy.blocklistCreateRule(requestBody, cardBin, globalState))
.catch((e) => {
if (/status: 409/.test(e.message)) {
// rule already exists — delete and recreate once
cy.blocklistDeleteRule('card_bin', cardBin, globalState);
return cy.blocklistCreateRule(requestBody, cardBin, globalState);
}
throw e;
}); Prevention
- Pair every create with a delete in cleanup hooks so reruns start clean
- Validate cardBin format (6-9 digits) before sending
- Confirm the apiKey in globalState matches the environment's blocklist-enabled merchant
When it happens
Trigger: Re-creating a card_bin rule that already exists (duplicate/conflict); invalid or missing apiKey (401/403); malformed card bin value (400); blocklist feature disabled in the environment (404/501).
Common situations: Rerunning specs without cleanup, leaving the previous run's rule in place; wrong apiKey in globalState for this environment; feature flag for the blocklist API off in staging.
Related errors
- Blocklist delete failed with status: ${response.status} and
- User login call failed to get totp token with status: "${res
- User login call failed to fetch user info with status: "${re
- Expected no deny action for non-blocklisted card
- Unsupported connector: ${connectorId}
AI-assisted analysis of juspay/hyperswitch@9b8b89dc37 (2026-08-16).
Data as JSON: /api/errors/f227194e40213458.
Report an issue: GitHub.