{"record":{"id":"2adba03f638d2deb","repo":"mjmlio/mjml","slug":"dependencies-option-should-be-provided-to-mjml-v","errorCode":null,"errorMessage":"\"dependencies\" option should be provided to mjml validator","messagePattern":"\"dependencies\" option should be provided to mjml validator","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/mjml-validator/src/index.js","lineNumber":23,"sourceCode":"  assignDependencies,\n} from './dependencies'\n\nconst SKIP_ELEMENTS = ['mjml']\n\nexport const formatValidationError = ruleError\n\nexport { rulesCollection, registerRule }\n\nexport { dependencies, registerDependencies, assignDependencies }\n\nexport default function MJMLValidator(element, options = {}) {\n  const { children, tagName } = element\n  const errors = []\n\n  const skipElements = options.skipElements || SKIP_ELEMENTS\n\n  if (options.dependencies == null) {\n    console.warn('\"dependencies\" option should be provided to mjml validator')\n  }\n\n  if (!skipElements.includes(tagName)) {\n    for (const rule of Object.values(rulesCollection)) {\n      const ruleError = rule(element, {\n        dependencies,\n        skipElements,\n        ...options,\n      })\n      if (Array.isArray(ruleError)) {\n        errors.push(...ruleError)\n      } else if (ruleError) {\n        errors.push(ruleError)\n      }\n    }\n  }\n\n  if (children && children.length > 0) {","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/mjmlio/mjml/blob/6c01d35af5da14108b86bbf052232e99de7ca755/packages/mjml-validator/src/index.js#L5-L41","documentation":"MJMLValidator warns when options.dependencies is null or undefined, because validation rules (e.g. ending-tags checks) rely on the registered component dependencies to decide element relationships. Missing dependencies can produce incorrect or incomplete validation results, so the validator warns and falls back to the module-level dependencies object.","triggerScenarios":"Calling MJMLValidator(element, options) — directly or via mjml2html's validation path — with an options object lacking the dependencies property. Fired once per validation run whenever options.dependencies == null.","commonSituations":"Calling mjml2html with a custom validation flow that drops options; using MJMLValidator directly in tests without building the options object; wrapper libraries that forget to forward the dependencies option.","solutions":["Pass the dependencies collected from mjml-core into options: mjml2html(mjml, { dependencies }) or MJMLValidator(element, { dependencies })","Call registerDependencies first so the module-level fallback is populated","If using mjml2html normally, ensure middleware/custom code does not strip options.dependencies","Update wrapper code to forward all validator options"],"exampleFix":"// before\nMJMLValidator(element, { skipElements: ['mj-body'] })\n// after\nimport dependencies from 'mjml-core' // or collect via mjml-core's component registration\nMJMLValidator(element, { skipElements: ['mj-body'], dependencies })","handlingStrategy":"validation","validationCode":"import mjmlCoreDependencies from 'mjml-core' // or your registered set\nconst opts = { ...options }\nif (opts.dependencies == null) opts.dependencies = mjmlCoreDependencies\nreturn MJMLValidator(element, opts)","typeGuard":"const hasDependencies = (o) => o != null && typeof o === 'object' && o.dependencies != null","tryCatchPattern":null,"preventionTips":["Always forward the dependencies option through custom mjml2html/validator wrappers","Call registerDependencies during app init so the fallback is populated","Add an assertion in test helpers that validator options include dependencies","When upgrading MJML, re-check that custom validation code passes dependencies"],"tags":["validation","missing-option","mjml","dependencies","validator"],"backgroundTag":"missing-validator-option","analyzedSha":"6c01d35af5da14108b86bbf052232e99de7ca755","analyzedAt":"2026-09-02T21:31:03.649Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}