** (ArgumentError) errors were found at the given arguments

Hi,

I am running my application in Docker container. Everything was fine (meaning I was able to start the container) until suddenly it stopped running and I began to see this Error -

** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not a textual representation of an integer

    :erlang.binary_to_integer("")
    (stdlib 3.17) erl_eval.erl:685: :erl_eval.do_apply/6
    (stdlib 3.17) erl_eval.erl:893: :erl_eval.expr_list/6
    (stdlib 3.17) erl_eval.erl:237: :erl_eval.expr/5
    (stdlib 3.17) erl_eval.erl:229: :erl_eval.expr/5
    (stdlib 3.17) erl_eval.erl:230: :erl_eval.expr/5
    (stdlib 3.17) erl_eval.erl:893: :erl_eval.expr_list/6
    (stdlib 3.17) erl_eval.erl:408: :erl_eval.expr/5

I have no idea what caused it and I am not sure where to start looking, as for me, it’s not the most descriptive information.

I will be thankful for some help or hints.

You probably use String.to_integer on an empty value…

iex> String.to_integer ""
** (ArgumentError) argument error
    :erlang.binary_to_integer("")

In case it could fail, You should use Integer.parse instead.

4 Likes

I do use String.to_integer in couple of places. So what you suggest is to replace those with Integer.parse, so if a value is empty it will not return this error?

Yes, it’s done for this case…

Thank you very much!