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

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"

Could you provide a script that reproduces this crash?

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

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 and we’ll take care of this.