Reusing function variables in a `when` conditional

I am using the Exercism practice platform which attempts to test the code

 ** (FunctionClauseError) no function clause matching in RomanNumerals.iteraterefs/5
...
Attempted function clauses (showing 1 out of 1):

         def iteraterefs(divisor, number, table, out, i) when number >= divisor

In the above number >= divisor has red text highlighting. The function is being called in a Enum.each like this:

    Enum.each(refs, fn(divisor) -> 
      iteraterefs(divisor, number, table, out, i)
      i = i + 1
    end)

And is defined as:

  def iteraterefs(divisor, number, table, out, i) when number >= divisor do
    number = number - divisor
    out = out <> elem(table, i)
  end