Skip to content

Troubleshooting ​

Labels not working ("The name field" instead of "The Full Name field") Add use HasFluentRules. The trait extracts labels from rule objects and passes them to the validator, so every message uses them. Without it, a label shows only in the messages of its own rule object, not in a rule elsewhere that names the field, such as required_with:name.

Child form request loses or corrupts parent rulesarray_merge_recursive flattens FluentRule objects into arrays. See Extending parent rules for the supported merge patterns (put(), except(), modify(), modifyEach(), modifyChildren(), spread and clone).

Method not found on a rule type Use ->rule('method_name') as an escape hatch for any Laravel rule not yet available as a fluent method. Accepts strings, objects, and ['rule', ...$params] tuples. If you think it should be a native method, open an issue and we'll add it.

UnknownFluentRuleMethod: FluentRule::field() has no method ...()FluentRule::field() is the untyped builder; type-specific rules (min, max, regex, email, digits, mimes, before, after, contains) live on the typed builders. The exception message names the builders that expose the method. Pick the one matching your field's type:

php
FluentRule::numeric()->required()->min(5);   // numeric value
FluentRule::string()->required()->min(5);    // string length
FluentRule::array()->required()->min(5);     // element count
FluentRule::file()->required()->min('2mb');  // file size

The smell-form FluentRule::field()->rule('min:1') (or any ->rule('some_type_rule:...') on field()) works at runtime but is non-idiomatic. Pick the typed builder. The Rector companion auto-simplifies it. For test-time coverage, see SanderMuller\FluentValidation\Testing\Arch\BansFieldRuleTypeMethods (requires nikic/php-parser dev dep).

HasFluentValidation conflicts with Filament's InteractsWithForms / InteractsWithSchemas Use HasFluentValidationForFilament instead. See Livewire → Filament components. The Rector companion picks it plus the insteadof block automatically.

Migration issues (Rector companion) Rector-specific issues are tracked in the laravel-fluent-validation-rector README. Update the Rector companion to the latest version first; most are fixed upstream.