# Unhelpful error message for duplicate xpath reference in xml filter

**URL:** <https://discuss.elastic.co/t/unhelpful-error-message-for-duplicate-xpath-reference-in-xml-filter/127389>\
**Category:** Logstash\
**Created:** [April 9, 2018, 9:29pm UTC](https://discuss.elastic.co/t/unhelpful-error-message-for-duplicate-xpath-reference-in-xml-filter/127389 "2018-04-09T21:29:28Z")\
**Posts on this page:** 4\
**Page:** 1

<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 9, 2018, 9:29pm UTC](https://discuss.elastic.co/t/unhelpful-error-message-for-duplicate-xpath-reference-in-xml-filter/127389/1 "2018-04-09T21:29:28Z")

</div>

In 6.2 this config

```auto
input { generator { message => '<a>1</a>' count => 1 } }
output { stdout { codec => rubydebug } }
filter {
    xml {
      source => "message"
      xpath => {
        "/a" => "a"
        "/a" => "b"
      }
    }
}

```

get the extraordinarily unhelpful error message

```auto
[2018-04-09T17:16:16,509][ERROR][logstash.agent] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"NameError", :message=>"uninitialized constant LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Hash::ConfigurationError", :backtrace=>["org/jruby/RubyModule.java:3343:in `const_missing'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:184:in `validate!'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:202:in `expr'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:134:in `expr'", "org/jruby/RubyArray.java:2486:in `map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:98:in `expr_attributes'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:76:in `expr'", "org/jruby/RubyArray.java:2486:in `map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:69:in `expr'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:48:in `block in compile'", "org/jruby/RubyArray.java:1734:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/compiler/lscl.rb:46:in `compile'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:46:in `compile_imperative'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:50:in `compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:12:in `block in compile_sources'", "org/jruby/RubyArray.java:2486:in `map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:11:in `compile_sources'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:51:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:169:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:40:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:315:in `block in converge_state'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:141:in `with_pipelines'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:312:in `block in converge_state'", "org/jruby/RubyArray.java:1734:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:299:in `converge_state'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:166:in `block in converge_state_and_update'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:141:in `with_pipelines'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:164:in `converge_state_and_update'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:90:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:348:in `block in execute'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}

```

If this is a bug, which component is it a bug in? I ask because I see no reference to the filter in the stacktrace.

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [April 9, 2018, 9:59pm UTC](https://discuss.elastic.co/t/unhelpful-error-message-for-duplicate-xpath-reference-in-xml-filter/127389/2 "2018-04-09T21:59:00Z")

</div>

Oy, that is definitely unhelpful.

I've filed a PR to fix: [elastic/logstash#9343](https://github.com/elastic/logstash/pull/9343)

In the mean-time, maps with multiple values for the same key don't typically work out well (last entry wins); what is it you're trying to accomplish?

---

<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 10, 2018, 1:24pm UTC](https://discuss.elastic.co/t/unhelpful-error-message-for-duplicate-xpath-reference-in-xml-filter/127389/3 "2018-04-10T13:24:00Z")

</div>

> [@yaauie](#):
>
> what is it you're trying to accomplish?

It was [not intentional](https://discuss.elastic.co/t/help-with-parsing-xml-data/127383).

---

<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 8, 2018, 1:31pm UTC](https://discuss.elastic.co/t/unhelpful-error-message-for-duplicate-xpath-reference-in-xml-filter/127389/4 "2018-05-08T13:31:13Z")

</div>

Closed on May 8, 2018, 1:31pm UTC

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