#3100·joi

Warning on rejected async validation

Author: armpogartCreated Mar 4, 2026Updated Aug 3, 2026
Labelsbug

Runtime

node.js

Runtime version

18+

Module version

17.13.3

Last module version without issue

No response

Used with

standalone

Any other relevant information

No response

What are you trying to achieve or the steps to reproduce?

Currently synchronous validation returns ValidationResult<TSchema> type, which is following:

typescript
type ValidationResult<TSchema = any> = {
        error: undefined;
        warning?: ValidationError;
        value: TSchema;
    } | {
        error: ValidationError;
        warning?: ValidationError;
        value: any;
    }

So both in case of successful validation and error we always have warnings in the result. But when switching to asynchronous validation with warnings turned on validateAsync(value, { warnings: true }) in case of error the promise rejects and we have only ValidationError which doesn't incllude any warnings.

If this is by design, and synchronous and asynchronous validation have that difference, then it's not documented anywhere clearly.

Is there any way to still have the warnings in case of promise rejection for async validation?

What was the result you got?

error on promise rejection

What result did you expect?

error with warnings included