Skip to content

fieldMeta not set by async validator #2033

Closed

Description

@literalpie

Describe the bug

If fieldMeta doesn't exist when an async validator runs, it won't be created. (synchronous validators do cause the meta to get created).

If the meta already exists (because you have a form.Field for that field, or because you do something like setFieldValue('age', 2)), the error gets added to the fieldMeta without a problem.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-vxfykhc5?file=src%2Findex.tsx,package.json

Steps to reproduce

  1. Submit the form without clicking anything else. form.errors shows errors at the form level, but "Age Meta" remains empty
  2. Change onSubmitAsync to onSubmit, then submit the form. The meta gets created as expected.

Expected behavior

If errors happen when doing an async validation, the field meta should be created if necessary.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOS
Safari

TanStack Form adapter

react-form

TanStack Form version

1.28.0

TypeScript version

No response

Additional context

Possibly related to #1460

Activity

  1. added a commit that references this issue on Mar 2, 2026
    64f890b
  2. literalpie commented on Mar 2, 2026

    @literalpie
    ContributorAuthor

    This issue is a pretty big priority for us because of the way a few things interact:

    1. Yup validators are always async because of this issue. We are using Yup because the way it handles i18n is better for us than Zod.
    2. For compatibility with our old form solution, we use useFormContext to get/set value and state on fields that do not have a form.AppField mounted. I have found that, besides this issues, fieldMeta is the most reliable way to get the error state of fields.

    So I made a PR with a proposed fix for this.

  3. added a commit that references this issue on Mar 23, 2026
    fa0b555
  4. added a commit that references this issue on Jul 9, 2026
    6cd477a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions