juspay/hyperswitch · error · Error

methodFlow input is required

Error message

methodFlow input is required

What it means

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.

Source

Thrown at cypress-tests/cypress/support/commands.js:220

            return cy
              .task("cli_log", `   Status: ${response.status}`)
              .then(() => {
                return cy.task("cli_log", `   Error: ${errorMsg}`).then(() => {
                  return cy.wrap({
                    success: false,
                    flow: methodFlow,
                    error: errorMsg,
                  });
                });
              });
          });
      }
    });
}

function parseMethodFlows(methodFlowInput) {
  if (!methodFlowInput) {
    throw new Error("methodFlow input is required");
  }

  return methodFlowInput.includes(",")
    ? methodFlowInput
        .split(",")
        .map((flow) => flow.trim())
        .filter((flow) => flow.length > 0)
    : [methodFlowInput.trim()];
}

function createUcsConfigs(globalState, flow, type) {
  // --- Phase 1: Environment Setup & Validation ---
  const ucsEnabled = globalState.get("ucsEnabled");
  if (!ucsEnabled) {
    cy.task(
      "cli_log",
      `UCS ${type} config creation skipped - ucsEnabled is false or not set`
    );

View on GitHub (pinned to 9b8b89dc37)

Solutions

  1. Pass a non-empty flow string: createUcsConfigs(globalState, 'upi_intent', 'rollout') or set globalState methodFlow
  2. Keep the upstream guard (error 17) before parseMethodFlows so callers get the more informative message
  3. Default the input at the call site: parseMethodFlows(methodFlowInput || globalState.get('methodFlow')) with a prior existence check

Example fix

// before
const methodFlows = parseMethodFlows(methodFlowInput); // methodFlowInput undefined

// after
const methodFlowInput = flow || globalState.get('methodFlow');
if (!methodFlowInput) {
  throw new Error('Missing connectorId or methodFlow in globalState');
}
const methodFlows = parseMethodFlows(methodFlowInput);
Defensive patterns

Strategy: validation

Validate before calling

// Mirror the upstream guard before parsing flows
const methodFlowInput = flow || globalState.get('methodFlow');
if (!methodFlowInput) {
  cy.log('UCS config creation skipped: methodFlow not provided');
  return;
}
const methodFlows = parseMethodFlows(methodFlowInput);

Prevention

When it happens

Trigger: 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.

Common situations: Refactoring createUcsConfigs validation; new call sites assuming parseMethodFlows defaults the input; UCS specs running without the METHOD_FLOW env/tag that populates globalState.

Related errors


AI-assisted analysis of juspay/hyperswitch@9b8b89dc37 (2026-08-16). Data as JSON: /api/errors/475af9418c60f3de. Report an issue: GitHub.