{"record":{"id":"c0acd990a31d4eac","repo":"medusajs/medusa","slug":"invalid-step-input","errorCode":null,"errorMessage":"Invalid step input","messagePattern":"Invalid step input","errorType":"exception","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/customer/steps/maybe-unset-default-billing-addresses.ts","lineNumber":92,"sourceCode":"    if (isDefined(data.create)) {\n      // eslint-disable-next-line @medusajs/step-must-return-step-response\n      return unsetForCreate(\n        data.create,\n        customerModuleService,\n        \"is_default_billing\"\n      )\n    }\n\n    if (isDefined(data.update)) {\n      // eslint-disable-next-line @medusajs/step-must-return-step-response\n      return unsetForUpdate(\n        data.update,\n        customerModuleService,\n        \"is_default_billing\"\n      )\n    }\n\n    throw new MedusaError(\n      MedusaError.Types.INVALID_DATA, \n      \"Invalid step input\"\n    )\n  },\n  async (addressesToSet, { container }) => {\n    if (!addressesToSet?.length) {\n      return\n    }\n\n    const customerModuleService = container.resolve<ICustomerModuleService>(\n      Modules.CUSTOMER\n    )\n\n    await customerModuleService.updateCustomerAddresses(\n      { id: addressesToSet },\n      { is_default_billing: true }\n    )\n  }","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/customer/steps/maybe-unset-default-billing-addresses.ts#L74-L110","documentation":"Defensive branch in maybeUnsetDefaultBillingAddressesStep: the input matched neither the 'remove' nor the 'update' shape the step expects, so it cannot determine which addresses to unflag. In practice unreachable for well-formed workflow input.","triggerScenarios":"Invoking maybeUnsetDefaultBillingAddressesStep directly with an input object that lacks both data.remove and data.update, or has both falsy.","commonSituations":"Custom workflow code calling the step directly with a hand-built payload; refactors that renamed the input keys (remove/update); type drift after upgrading @medusajs/core-flows.","solutions":["Check the step input: it must contain either data.remove (customer/address ids) or data.update (address updates touching is_default_billing)","Use the official workflows (updateCustomer, createCustomer) instead of composing this internal step yourself","Pin/upgrade @medusajs/core-flows so the step input type matches your call"],"exampleFix":"// before\nawait maybeUnsetDefaultBillingAddressesStep(container).run({\n  input: { data: {} },\n})\n\n// after\nawait maybeUnsetDefaultBillingAddressesStep(container).run({\n  input: { data: { update: [{ id: addrId, is_default_billing: true, customer_id }] } },\n})","handlingStrategy":"type-guard","validationCode":"if (!('remove' in data || 'update' in data) || (!data.remove && !data.update)) throw new Error('Step input must include remove or update')","typeGuard":"const hasRemoveOrUpdate = (d: { remove?: unknown; update?: unknown }) => !!(d?.remove || d?.update)","tryCatchPattern":null,"preventionTips":["Don't compose internal steps directly; use official customer workflows","Keep @medusajs/core-flows version aligned with your custom workflows"],"tags":["customer","billing-address","internal-step","core-flows"],"backgroundTag":"invalid-step-input","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}