# Logstash.filters.csv :exception=\>#\<RuntimeError: Invalid FieldReference: \`\[\]\`\>}

**URL:** <https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791>\
**Category:** Logstash\
**Created:** [April 8, 2019, 8:23am UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791 "2019-04-08T08:23:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zeal0us](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeal0us/32/43646_2.png) [@Zeal0us](https://discuss.elastic.co/u/Zeal0us)\
**Post date:** [April 8, 2019, 8:23am UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791/1 "2019-04-08T08:23:33Z")

</div>

Getting lines like this:

> [2019-04-08T08:13:50,464][WARN][logstash.filters.csv] Error parsing csv {:field=\>"message", :source=\>"", :exception=\>#\<RuntimeError: Invalid FieldReference: `[]`\>}

when trying to parse some csv files.

My input and filter look like:

```
input {
  file {
    path => ["/etc/logstash/csv_files/*.some.domain.net/*.csv"]
    mode => "read"
    ignore_older => 86400
  }
}
filter {
    csv {
        autodetect_column_names => true
        skip_empty_columns => true
        skip_header => true
    }

}

```

Any thoughts on why I may be getting these errors?

---

<div class="post-metadata">

**Author:** ![Zeal0us](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeal0us/32/43646_2.png) [@Zeal0us](https://discuss.elastic.co/u/Zeal0us)\
**Post date:** [April 8, 2019, 6:21pm UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791/2 "2019-04-08T18:21:58Z")

</div>

It appears FileReference.java does not like 1 item arrays, and thinks they are field references. Just used a string for a path and that seemed to fix it.

I did have to clear out all the queued data in (for me) /var/lib/logstash/queue/ while the process was stopped, then restart it.

Make sure you also have pipeline workers set to 1, or the other processes will interpret rows other than the first as headers.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 8, 2019, 7:14pm UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791/3 "2019-04-08T19:14:12Z")

</div>

> [@Zeal0us](#):
>
> field=\>"message", :source=\>""

That suggests that there is a blank line in the file, but I would expect a different exception for a blank line.

---

<div class="post-metadata">

**Author:** ![Zeal0us](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeal0us/32/43646_2.png) [@Zeal0us](https://discuss.elastic.co/u/Zeal0us)\
**Post date:** [April 8, 2019, 8:28pm UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791/4 "2019-04-08T20:28:07Z")

</div>

I replaced the source with "" and that seemed to cause it to not render on the page. That said, I posted how I was able to solve it.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 8, 2019, 9:57pm UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791/5 "2019-04-08T21:57:50Z")

</div>

> [@Zeal0us](#):
>
> Just used a string for a path and that seemed to fix it.

It is extremely unlikely that changing that could prevent the **csv** filter throwing an exception.

---

<div class="post-metadata">

**Author:** ![Zeal0us](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeal0us/32/43646_2.png) [@Zeal0us](https://discuss.elastic.co/u/Zeal0us)\
**Post date:** [April 9, 2019, 12:14pm UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791/6 "2019-04-09T12:14:24Z")

</div>

Odd, since it did seem to fix it.  
Note that the error seems to be thrown by [FileReference.java](https://github.com/elastic/logstash/blob/master/logstash-core/src/main/java/org/logstash/FieldReference.java) (see line 283) where it looks for ambiguous syntax. It took me a very long time to track it down specifically because, as you mention, it makes little sense that it would be the CSV plugin throwing the error, but here we are.

I believe it's an issue of parsing one item arrays as fields.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 7, 2019, 12:14pm UTC](https://discuss.elastic.co/t/logstash-filters-csv-exception-runtimeerror-invalid-fieldreference/175791/7 "2019-05-07T12:14:26Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
