# Strange dry-validation / dry-schema bug

**URL:** <https://discourse.dry-rb.org/t/strange-dry-validation-dry-schema-bug/1749>\
**Category:** dry-validation\
**Created:** [November 7, 2023, 1:28am UTC](https://discourse.dry-rb.org/t/strange-dry-validation-dry-schema-bug/1749 "2023-11-07T01:28:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![postmodern](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/postmodern/32/696_2.png) [@postmodern](https://discourse.dry-rb.org/u/postmodern)\
**Post date:** [November 7, 2023, 1:28am UTC](https://discourse.dry-rb.org/t/strange-dry-validation-dry-schema-bug/1749/1 "2023-11-07T01:28:56Z")

</div>

Ran into this `NilClass` exception coming from `dry-logic`, via `dry-schema` and `dry-valiation`.

Code in question: [https://github.com/ronin-rb/ronin-app/blob/e7b0b7880f1e5c41a29750596d951ba6b0bb35f1/lib/ronin/app/validations/recon\_params.rb#L41-L62](https://github.com/ronin-rb/ronin-app/blob/e7b0b7880f1e5c41a29750596d951ba6b0bb35f1/lib/ronin/app/validations/recon_params.rb#L41-L62)  
Spec Failure: [allow `ignore` to be empty since it's submitted via an HTML form. · ronin-rb/ronin-app@e7b0b78 · GitHub](https://github.com/ronin-rb/ronin-app/actions/runs/6778728934/job/18424670680#step:6:413)

```auto
  1) Ronin::App::Validations::ReconParams rules :ignore must allow an empty value for :ignore
     Failure/Error:
       result = subject.call(
         {
           scope: 'example.com',
           ignore: ''
         }
       )

     NoMethodError:
       undefined method `map' for nil:NilClass
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/each.rb:12:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/and.rb:23:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/key.rb:37:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-logic-1.5.0/lib/dry/logic/operations/implication.rb:19:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/rule_applier.rb:30:in `block in call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/rule_applier.rb:27:in `each'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/rule_applier.rb:27:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/step.rb:34:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor_steps.rb:38:in `block in call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor_steps.rb:36:in `each'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor_steps.rb:36:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor.rb:79:in `block in call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/result.rb:35:in `new'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-schema-1.13.3/lib/dry/schema/processor.rb:78:in `call'
     # ./vendor/bundle/ruby/3.2.0/gems/dry-validation-1.10.0/lib/dry/validation/contract.rb:98:in `call'
     # ./spec/validations/recon_params_spec.rb:69:in `block (4 levels) in <top (required)>'

```

I am not sure what is trigger the exception or why. Obviously this needs some guard logic or a better exception message.

Versions:

- dry-core (1.0.1)
- dry-types (1.7.1)
- dry-logic (1.5.0)
- dry-schema (1.13.3)
- dry-validation (1.10.0)
