#1252·vuelidate

helpers.forEach

Author: charbyte-techCreated Sep 20, 2024Updated Oct 22, 2025
Labelsbug2.0

Make sure that you are familiar with documentation before submitting an issue.

Description: I’m using Vuelidate to validate an array of objects in a Vue 3 application with TypeScript. I'm trying to apply validations using helpers.forEach on a field that is an array containing nested objects. However, when attempting to render or access the validated data, I get the following error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map') at $message (@vuelidate_validators.js:161:44) at @vuelidate_core.js:190:57 at ReactiveEffect.fn (vue.js:1246:13) at ReactiveEffect.run (vue.js:435:19) at get value (vue.js:1258:107) at MutableReactiveHandler.get (vue.js:740:61) at JSON.stringify () at toDisplayString (vue.js:256:196) at Proxy._sfc_render (MyComponent.vue:74:21) at renderComponentRoot (vue.js:7758:17)

Steps to Reproduce:

Vuelidate 2 - Composition API + Vue 3

// I define the validation rules using helpers.forEach as follows:
const rules = {
  collection: {
    $each: helpers.forEach({
      name: {
        required,
        object: {
          value: {
            required,
          },
        },
      },
    }),
  },
};

//I have the following state defined
const state = {
  collection: [
    {
      name: '',
      object: {
        value: null,
      },
    },
    {
      name: 'bar',
      object: {
        value: 1,
      },
    },
  ],
};

//I apply useVuelidate for validation
const v = useVuelidate(rules, state);

Expected behavior When I attempt to access the validations or display the results, the error mentioned above occurs.

Screenshots image