# Interpreting error message / stacktrace for CSV.File

**URL:** <https://discourse.julialang.org/t/interpreting-error-message-stacktrace-for-csv-file/58539>\
**Category:** New to Julia\
**Created:** [April 4, 2021, 12:19am UTC](https://discourse.julialang.org/t/interpreting-error-message-stacktrace-for-csv-file/58539 "2021-04-04T00:19:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![George9000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/george9000/32/23619_2.png) [@George9000](https://discourse.julialang.org/u/George9000)\
**Post date:** [April 4, 2021, 12:19am UTC](https://discourse.julialang.org/t/interpreting-error-message-stacktrace-for-csv-file/58539/1 "2021-04-04T00:19:13Z")

</div>

System: macOS 10.15.7  
Julia version 1.6

I use R heavily for data analysis in the life sciences and am slowly learning Julia for similar tasks with DataFrames.jl and CSV.jl. Recently I was tripped up by a small error and would like to learn how I could improve my reading of Julia’s error messages.

How could I have improved my approach to diagnosing the following bug?

I made this call:

```julia
CSV.File("filepath",
               normalizenames = true,
               missingstring = ["", "NULL", "NA"])

```

and received this Error/stacktrace:

```julia
ERROR: MethodError: no method matching contains(::Vector{String}, ::String)
Closest candidates are:
  contains(::AbstractString, ::Any) at strings/util.jl:98
  contains(::Any) at strings/util.jl:159
Stacktrace:
 [1] Header
   @ ~/.julia/packages/CSV/CJfFO/src/header.jl:155 [inlined]
 [2] CSV.File(source::String; header::Int64, normalizenames::Bool, datarow::Int64, skipto::Nothing, footerskip
::Int64, transpose::Bool, comment::Nothing, use_mmap::Nothing, ignoreemptylines::Bool, select::Nothing, drop::
Nothing, missingstrings::Vector{String}, missingstring::Vector{String}, delim::Nothing, ignorerepeated::Bool, 
quotechar::Char, openquotechar::Nothing, closequotechar::Nothing, escapechar::Char, dateformat::Nothing, dateformats::Nothing, decimal::UInt8, truestrings::Vector{String}, falsestrings::Vector{String}, type::Nothing, types::Nothing, typemap::Dict{Type, Type}, pool::Float64, lazystrings::Bool, strict::Bool, silencewarnings::Bool, debug::Bool, parsingdebug::Bool, kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}
)                                                                                                            
   @ CSV ~/.julia/packages/CSV/CJfFO/src/file.jl:217

```

I didn’t look at `strings/util.jl` as I suspected the error lay in my `CSV.File` call. I did look at `header.jl` and `file.jl` at the lines mentioned in the stacktrace. Neither were revealing.

There seems to be a mismatch of the argument signature but beyond that I found no clue to which argument.

Eventually, I figured out that it was a typo. There are two similar keyword arguments in CSV.File: missingstring and missingstrings. I had used the singular and given a vector with more than one value. Note that both arguments take a Vector{String} type `missingstrings::Vector{String}, missingstring::Vector{String}`.

Any recommendations on a better approach to reading the error message would be appreciated. It does seem that `missingstring[s]` should be made into one keyword argument that can take one or more values.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [April 4, 2021, 6:14am UTC](https://discourse.julialang.org/t/interpreting-error-message-stacktrace-for-csv-file/58539/2 "2021-04-04T06:14:34Z")

</div>

Hm, I don’t think there is a better approach here - keyword arguments don’t participate in dispatch, so the Methoderror only happens further down the function which always makes it harder to figure out.

I would argue that this particular case with two almost identical kwargs that take different input types might warrant an argument check with a specific error message for your case, maybe open an issue?

---

<div class="post-metadata">

**Author:** ![George9000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/george9000/32/23619_2.png) [@George9000](https://discourse.julialang.org/u/George9000)\
**Post date:** [April 5, 2021, 3:19pm UTC](https://discourse.julialang.org/t/interpreting-error-message-stacktrace-for-csv-file/58539/3 "2021-04-05T15:19:36Z")

</div>

Thank you. Will take your suggestion about opening an issue.
