{"record":{"id":"e17ad97fe6e65aae","repo":"medusajs/medusa","slug":"invalid-step-input-e17ad9","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-shipping-addresses.ts","lineNumber":91,"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_shipping\"\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_shipping\"\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_shipping: true }\n    )\n  }","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/customer/steps/maybe-unset-default-shipping-addresses.ts#L73-L109","documentation":"Defensive branch in maybeUnsetDefaultShippingAddressesStep: the input matched neither the 'remove' nor the 'update' shape, so the step cannot determine which addresses to unflag. Unreachable for well-formed workflow input.","triggerScenarios":"Invoking maybeUnsetDefaultShippingAddressesStep directly with an input lacking both data.remove and data.update.","commonSituations":"Custom workflow composing the internal step with hand-built payload; renamed input keys after upgrade; type drift between versions.","solutions":["Ensure the step input contains either data.remove or data.update (updates touching is_default_shipping)","Use official customer workflows instead of the raw step","Pin/upgrade @medusajs/core-flows to match the step's expected input type"],"exampleFix":"// before\nawait maybeUnsetDefaultShippingAddressesStep(container).run({\n  input: { data: {} },\n})\n\n// after\nawait maybeUnsetDefaultShippingAddressesStep(container).run({\n  input: { data: { update: [{ id: addrId, is_default_shipping: true, customer_id }] } },\n})","handlingStrategy":"type-guard","validationCode":"if (!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","Type-check custom step inputs against the exported input types"],"tags":["customer","shipping-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"}