AUR4101

Error Message

AUR4101: No rule has been added

Description

This error occurs when attempting to use a validation rule provider that has no rules defined. This typically happens when:

  1. Trying to validate an object before any validation rules have been configured

  2. The rule provider was created but no rules were added to it

  3. Rules were cleared or removed and validation is attempted on an empty rule set

Common Scenarios

// ❌ Problem: No rules defined
const ruleProvider = new ValidationRuleProvider();
// Attempting to validate without adding any rules
ruleProvider.validate(model); // Throws AUR4101

Solution

// ✅ Correct: Add rules before validation
import { ValidationRules } from '@aurelia/validation';

ValidationRules
  .ensure('userName').required().minLength(3)
  .ensure('email').required().email()
  .on(MyModel);

// Now validation will work
const result = await validator.validate(model);

Last updated

Was this helpful?