medusajs/medusa · error · MedusaError

Field(s) are required to have value to continue - ${invalidF

Error message

Field(s) are required to have value to continue - ${invalidFields}

What it means

Generic presence-check step (validatePresenceOfStep) that throws INVALID_DATA when one or more required fields on the input object are undefined/null. Workflows use it to enforce that caller-supplied values exist before continuing.

Source

Thrown at packages/core/core-flows/src/common/steps/validate-presence-of.ts:27

  async function ({
    entity,
    fields,
  }: {
    entity: Record<any, unknown>
    fields: string[]
  }) {
    const invalid: string[] = []

    for (const field of fields) {
      if (!isPresent(entity[field])) {
        invalid.push(field)
      }
    }

    if (invalid.length) {
      const invalidFields = invalid.join(", ")

      throw new MedusaError(
        MedusaError.Types.INVALID_DATA,
        `Field(s) are required to have value to continue - ${invalidFields}`
      )
    }
  }
)

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Read the error message suffix — it names the exact missing fields
  2. Add the missing field(s) to the workflow input before running
  3. If building inputs dynamically, strip undefined keys and assert required fields with a schema (zod) before invoking the workflow

Example fix

// before
await someWorkflow(container).run({ input: { currency_code: undefined } })
// throws: Field(s) are required to have value to continue - currency_code

// after
await someWorkflow(container).run({ input: { currency_code: "usd" } })
Defensive patterns

Strategy: validation

Validate before calling

const missing = presence.filter((f) => input[f] == null)
if (missing.length) throw new Error(`Missing required fields: ${missing.join(", ")}`)

Try / catch

try { await workflow(scope).run({ input }) } catch (e) { if (e.type === MedusaError.Types.INVALID_DATA && /required to have value/.test(e.message)) { /* extract field names from message and prompt user */ } throw e }

Prevention

When it happens

Trigger: Invoking a workflow that wraps validatePresenceOfStep without supplying one of the fields listed in its 'presence' config (e.g. missing id, missing email, missing currency_code depending on the workflow).

Common situations: Client sends a partial payload; form field omitted; integration builds the workflow input dynamically and a property ends up undefined; API schema loosened in an upgrade so previously-required fields are no longer auto-validated earlier.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/7dde2ad9743a2785. Report an issue: GitHub.