{"record":{"id":"475af9418c60f3de","repo":"juspay/hyperswitch","slug":"methodflow-input-is-required","errorCode":null,"errorMessage":"methodFlow input is required","messagePattern":"methodFlow input is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/support/commands.js","lineNumber":220,"sourceCode":"            return cy\n              .task(\"cli_log\", `   Status: ${response.status}`)\n              .then(() => {\n                return cy.task(\"cli_log\", `   Error: ${errorMsg}`).then(() => {\n                  return cy.wrap({\n                    success: false,\n                    flow: methodFlow,\n                    error: errorMsg,\n                  });\n                });\n              });\n          });\n      }\n    });\n}\n\nfunction parseMethodFlows(methodFlowInput) {\n  if (!methodFlowInput) {\n    throw new Error(\"methodFlow input is required\");\n  }\n\n  return methodFlowInput.includes(\",\")\n    ? methodFlowInput\n        .split(\",\")\n        .map((flow) => flow.trim())\n        .filter((flow) => flow.length > 0)\n    : [methodFlowInput.trim()];\n}\n\nfunction createUcsConfigs(globalState, flow, type) {\n  // --- Phase 1: Environment Setup & Validation ---\n  const ucsEnabled = globalState.get(\"ucsEnabled\");\n  if (!ucsEnabled) {\n    cy.task(\n      \"cli_log\",\n      `UCS ${type} config creation skipped - ucsEnabled is false or not set`\n    );","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/support/commands.js#L202-L238","documentation":"Thrown by parseMethodFlows in cypress-tests/cypress/support/commands.js when its argument is falsy. It splits a comma-separated method-flow string (e.g. 'upi,cards') into trimmed flow names for UCS (universal checkout setting) rollout/shadow config creation. Note: today createUcsConfigs checks !connector || !methodFlowInput first (line 253) and throws error 17, so hitting this exact throw means parseMethodFlows was called directly or the guard order changed.","triggerScenarios":"parseMethodFlows(undefined) / parseMethodFlows('') — a direct call, or createUcsConfigs invoked with neither a flow argument nor globalState.get('methodFlow') set AND after the earlier guard was removed or reordered.","commonSituations":"Refactoring createUcsConfigs validation; new call sites assuming parseMethodFlows defaults the input; UCS specs running without the METHOD_FLOW env/tag that populates globalState.","solutions":["Pass a non-empty flow string: createUcsConfigs(globalState, 'upi_intent', 'rollout') or set globalState methodFlow","Keep the upstream guard (error 17) before parseMethodFlows so callers get the more informative message","Default the input at the call site: parseMethodFlows(methodFlowInput || globalState.get('methodFlow')) with a prior existence check"],"exampleFix":"// before\nconst methodFlows = parseMethodFlows(methodFlowInput); // methodFlowInput undefined\n\n// after\nconst methodFlowInput = flow || globalState.get('methodFlow');\nif (!methodFlowInput) {\n  throw new Error('Missing connectorId or methodFlow in globalState');\n}\nconst methodFlows = parseMethodFlows(methodFlowInput);","handlingStrategy":"validation","validationCode":"// Mirror the upstream guard before parsing flows\nconst methodFlowInput = flow || globalState.get('methodFlow');\nif (!methodFlowInput) {\n  cy.log('UCS config creation skipped: methodFlow not provided');\n  return;\n}\nconst methodFlows = parseMethodFlows(methodFlowInput);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the informative guard (error 17) ahead of parseMethodFlows in createUcsConfigs","Pass an explicit flow argument for new call sites instead of relying on globalState","Treat a hit of this exact throw as a signal that validation order was refactored"],"tags":["cypress","ucs","method-flow","validation"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}