# Unable to normalise argument error

**URL:** <https://in-thread.sonic-pi.net/t/unable-to-normalise-argument-error/9190>\
**Category:** Support, Help & Resources\
**Created:** [September 6, 2024, 5:54pm UTC](https://in-thread.sonic-pi.net/t/unable-to-normalise-argument-error/9190 "2024-09-06T17:54:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HarryLeBlanc](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/harryleblanc/32/2813_2.png) [@HarryLeBlanc](https://in-thread.sonic-pi.net/u/HarryLeBlanc)\
**Post date:** [September 6, 2024, 5:54pm UTC](https://in-thread.sonic-pi.net/t/unable-to-normalise-argument-error/9190/1 "2024-09-06T17:54:36Z")

</div>

Okay, this is weird. This code throws an error:

```ruby
kwargs = {amp: 2, foo: [1, 2, 3]}

sample :bd_808, **kwargs

```

This seems trivial, but I need to find a fix, because I have wrapper methods where I can pass in arbitrary params to control a sample or synth, and I need to pass them through to the synth or sample.  
But if the value of the hash is an array, it totally chokes.  
I’ve hacked the code I’m working on to strip out all args that contain array values in the hash, but I’d like a more elegant solution – and an explanation of why this is happening!  
Any insights?  
Thanks!

---

<div class="post-metadata">

**Author:** ![emlyn](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/emlyn/32/1460_2.png) [@emlyn](https://in-thread.sonic-pi.net/u/emlyn)\
**Post date:** [September 7, 2024, 12:23pm UTC](https://in-thread.sonic-pi.net/t/unable-to-normalise-argument-error/9190/2 "2024-09-07T12:23:51Z")

</div>

It looks like it’s coming from [here](https://github.com/sonic-pi-net/sonic-pi/blob/6a93b79df71e4645999bc48af7e5f851adfddec1/app/server/ruby/lib/sonicpi/lang/sound.rb#L3410-L3451) in the Sonic Pi source code.  
I don’t think arrays are valid values for any arguments to `sample`, so I’m not sure why you would want to pass them in in the first place?  
If you’re accepting arbitrary keys/values it seems valid to remove any arrays because they can’t do anything useful anyway.

---

<div class="post-metadata">

**Author:** ![HarryLeBlanc](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/harryleblanc/32/2813_2.png) [@HarryLeBlanc](https://in-thread.sonic-pi.net/u/HarryLeBlanc)\
**Post date:** [September 7, 2024, 3:51pm UTC](https://in-thread.sonic-pi.net/t/unable-to-normalise-argument-error/9190/3 "2024-09-07T15:51:56Z")

</div>

OK, that helps. The message was so obscure, but reading the source makes sense.  
Filtering it is, then.  
Thanks!
