{"record":{"id":"7dde2ad9743a2785","repo":"medusajs/medusa","slug":"field-s-are-required-to-have-value-to-continue","errorCode":null,"errorMessage":"Field(s) are required to have value to continue - ${invalidFields}","messagePattern":"Field\\(s\\) are required to have value to continue - (.+?)","errorType":"exception","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/common/steps/validate-presence-of.ts","lineNumber":27,"sourceCode":"  async function ({\n    entity,\n    fields,\n  }: {\n    entity: Record<any, unknown>\n    fields: string[]\n  }) {\n    const invalid: string[] = []\n\n    for (const field of fields) {\n      if (!isPresent(entity[field])) {\n        invalid.push(field)\n      }\n    }\n\n    if (invalid.length) {\n      const invalidFields = invalid.join(\", \")\n\n      throw new MedusaError(\n        MedusaError.Types.INVALID_DATA,\n        `Field(s) are required to have value to continue - ${invalidFields}`\n      )\n    }\n  }\n)\n","sourceCodeStart":9,"sourceCodeEnd":34,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/common/steps/validate-presence-of.ts#L9-L34","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the error message suffix — it names the exact missing fields","Add the missing field(s) to the workflow input before running","If building inputs dynamically, strip undefined keys and assert required fields with a schema (zod) before invoking the workflow"],"exampleFix":"// before\nawait someWorkflow(container).run({ input: { currency_code: undefined } })\n// throws: Field(s) are required to have value to continue - currency_code\n\n// after\nawait someWorkflow(container).run({ input: { currency_code: \"usd\" } })","handlingStrategy":"validation","validationCode":"const missing = presence.filter((f) => input[f] == null)\nif (missing.length) throw new Error(`Missing required fields: ${missing.join(\", \")}`)","typeGuard":null,"tryCatchPattern":"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 }","preventionTips":["Validate workflow input with zod before running","Parse the field list from the message to map back to form fields","Strip undefined keys when building inputs dynamically"],"tags":["validation","required-field","workflow-input"],"backgroundTag":"required-field-missing","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}