# Problem with adding an error message to my existing validation messages file

**URL:** <https://discourse.dry-rb.org/t/problem-with-adding-an-error-message-to-my-existing-validation-messages-file/92>\
**Category:** dry-validation\
**Created:** [August 10, 2016, 2:48am UTC](https://discourse.dry-rb.org/t/problem-with-adding-an-error-message-to-my-existing-validation-messages-file/92 "2016-08-10T02:48:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lonnieking](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/lonnieking/32/50_2.png) [@lonnieking](https://discourse.dry-rb.org/u/lonnieking)\
**Post date:** [August 10, 2016, 2:48am UTC](https://discourse.dry-rb.org/t/problem-with-adding-an-error-message-to-my-existing-validation-messages-file/92/1 "2016-08-10T02:48:49Z")

</div>

I’ve got a validation messages file which was working fine until I added the value for `supported?`.

Now I’m seeing the following error `Dry::Validation::MissingMessageError: message for supported? was not found`.

If I remove `supported?` (as well as the associated predicate usage from my validation schema) it all works fine.

Any suggestions on why adding the `supported?` message doesn’t seem to work for me?

This is the message file in question…

```
en:
  errors:
    id: "employee_id_or_email_required"
    email?: "invalid_email_format"
    old_enough?: "birth_date_too_recent"
    after?: "invalid_event_dates"
    valid_date?: "malformed_date_field"
    str?: "must_be_string"
    hash?: "must_be_object"
    filled?: "must_not_be_empty"
    supported?: "invalid_locale"
  rules:
    name:
      filled?: "name_required"
    birth_date:
      valid_date?: "malformed_birth_date"
    start_date:
      after?: "birth_date_after_start_date"
      valid_date?: "malformed_start_date"
    end_date:
      after?: "end_date_before_start_date"
      valid_date?: "malformed_end_date"
```

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/solnic/32/779_2.png) [@solnic](https://discourse.dry-rb.org/u/solnic)\
**Post date:** [August 10, 2016, 12:41pm UTC](https://discourse.dry-rb.org/t/problem-with-adding-an-error-message-to-my-existing-validation-messages-file/92/2 "2016-08-10T12:41:49Z")

</div>

Could you provide a script that reproduces this crash?

---

<div class="post-metadata">

**Author:** ![lonnieking](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/lonnieking/32/50_2.png) [@lonnieking](https://discourse.dry-rb.org/u/lonnieking)\
**Post date:** [August 11, 2016, 5:34am UTC](https://discourse.dry-rb.org/t/problem-with-adding-an-error-message-to-my-existing-validation-messages-file/92/3 "2016-08-11T05:34:28Z")

</div>

I played around with my code a bit more and discovered something interesting.

Changing the parameter name in the block passed to my custom predicate seemed to clear up the issue. It seems that using `locale` as a block parameter name (which I was) always produces a `Dry::Validation::MissingMessageError`. Changing that variable name to anything else was fine!

I have created a simple example of this here: [https://github.com/lonnieking/dry-validation-issue](https://github.com/lonnieking/dry-validation-issue)

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/solnic/32/779_2.png) [@solnic](https://discourse.dry-rb.org/u/solnic)\
**Post date:** [August 11, 2016, 9:57am UTC](https://discourse.dry-rb.org/t/problem-with-adding-an-error-message-to-my-existing-validation-messages-file/92/4 "2016-08-11T09:57:30Z")

</div>

Hmm this is strange. We have `:locale` as one of the error compiler options, _maybe_ for some weird reason there’s a conflict there. Please [report an issue](https://github.com/dry-rb/dry-validation/issues) and we’ll take care of this.
