{"record":{"id":"a2a680a5910bcacf","repo":"juspay/hyperswitch","slug":"business-profile-update-failed-response-body-er","errorCode":null,"errorMessage":"Business Profile Update Failed: ${response.body.error?.message || response.status}","messagePattern":"Business Profile Update Failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/support/commands.js","lineNumber":1093,"sourceCode":"            ).to.have.property(\"authentication_connectors\");\n            globalState.set(\n              \"authConnectors\",\n              response.body.authentication_connector_details\n                .authentication_connectors\n            );\n          }\n          if (updateBusinessProfileBody.merchant_country_code) {\n            expect(response.body.merchant_country_code).to.equal(\n              updateBusinessProfileBody.merchant_country_code\n            );\n          }\n          if (updateBusinessProfileBody.merchant_category_code) {\n            expect(response.body.merchant_category_code).to.equal(\n              updateBusinessProfileBody.merchant_category_code\n            );\n          }\n        } else {\n          throw new Error(\n            `Business Profile Update Failed: ${response.body.error?.message || response.status}`\n          );\n        }\n      });\n    });\n  }\n);\nCypress.Commands.add(\"verifyUrlParamExcluded\", (paramName, message) => {\n  cy.url().then((url) => {\n    const urlParams = new URLSearchParams(new URL(url).search);\n    expect(urlParams.has(paramName), paramName).to.be.false;\n    cy.task(\"cli_log\", message);\n  });\n});\n\nCypress.Commands.add(\"verifyUrlParamIncluded\", (paramName, message) => {\n  cy.url().then((url) => {\n    const urlParams = new URLSearchParams(new URL(url).search);","sourceCodeStart":1075,"sourceCodeEnd":1111,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/support/commands.js#L1075-L1111","documentation":"Thrown by the UpdateBusinessProfileTest command (cypress-tests/cypress/support/commands.js:1093) when POST {baseUrl}/account/{merchantId}/business_profile/{profileId} returns non-200. The message prefers response.body.error?.message and falls back to the bare numeric status when the body has no error object — a bare number usually means an HTML/gateway response (502/504), not a controlled API rejection.","triggerScenarios":"Updating with a profileId that is undefined in globalState (URL becomes .../business_profile/undefined and 404s) because profilePrefix doesn't match the create step; invalid merchant_country_code or merchant_category_code in updateBusinessProfileBody (400); expired api-key (401); gateway 502/504 where the body has no error.message so only the status prints.","commonSituations":"The profile was created under a namespaced prefix (e.g. 'webhookConfigProfile') but UpdateBusinessProfileTest was called with the default 'profile'; globalState reused from a previous run whose profile was deleted; MCC values the target environment rejects; running behind a flaky ingress.","solutions":["Check which form the message takes: an error string means a controlled API rejection, a bare number means infra/gateway failure","Verify globalState.get(`${profilePrefix}Id`) is set and pass the SAME profilePrefix used at creation","Validate merchant_country_code (ISO-3166 alpha-2) and merchant_category_code against the environment's accepted values","Confirm the api-key is current and the merchant still exists","For bare 502/504 statuses, retry against a healthy environment"],"exampleFix":"// before — profile created under a custom prefix but updated with the default (profileId undefined -> 404)\ncy.createBusinessProfileTest(body, globalState, 'webhookConfigProfile');\ncy.UpdateBusinessProfileTest(updateBody, a, b, c, d, globalState);\n// after — keep the prefix consistent\ncy.UpdateBusinessProfileTest(updateBody, a, b, c, d, globalState, 'webhookConfigProfile');","handlingStrategy":"try-catch","validationCode":"const profileId = globalState.get(`${profilePrefix}Id`);\nif (!profileId) {\n  throw new Error(`No profile id under '${profilePrefix}Id' — create the profile with this prefix before updating`);\n}","typeGuard":null,"tryCatchPattern":"cy.on('fail', (err) => {\n  if (err.message.includes('Business Profile Update Failed')) {\n    // an error string means API rejection; a bare number means gateway/infra failure\n    throw new Error(`Profile update rejected: ${err.message}`);\n  }\n  throw err;\n});","preventionTips":["Always pass the same profilePrefix to create and update commands","Treat a bare numeric status in the message as an infra signal, not a schema problem","Keep country/MCC fixtures aligned with the target environment's accepted values"],"tags":["cypress","hyperswitch","business-profile","profile-id","api-request"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}