# Error while using ingest attachment plugin on some docs

**URL:** <https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836>\
**Category:** Elasticsearch\
**Created:** [October 24, 2018, 2:58pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836 "2018-10-24T14:58:52Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![7ca884569f2642e2c488](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7ca884569f2642e2c488/32/75102_2.png) [@7ca884569f2642e2c488](https://discuss.elastic.co/u/7ca884569f2642e2c488)\
**Post date:** [October 24, 2018, 2:58pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/1 "2018-10-24T14:58:52Z")

</div>

Hello, I have some problems with ingest attachment plugin. It works most of the time but fails on some docs (.docx) with exception

```
2018-10-24T15:00:44,595][DEBUG][o.e.a.b.TransportBulkAction] [kz-el03-node2] failed to execute pipeline [attachment] for document [attachment-2018-10-18/attachments/2264af3b-7a48-4b7b-ae37-c256472de62c]
org.elasticsearch.ElasticsearchException: java.lang.IllegalArgumentException: ElasticsearchParseException[Error parsing document in field [data]]; nested: TikaException[Unexpected RuntimeException from org.apache.tika.parser.ParserDecorator$2@56c6f26e]; nested: NullPointerException;
	at org.elasticsearch.ingest.CompoundProcessor.newCompoundProcessorException(CompoundProcessor.java:156) ~[elasticsearch-5.6.11.jar:5.6.11]
	at org.elasticsearch.ingest.CompoundProcessor.execute(CompoundProcessor.java:107) ~[elasticsearch-5.6.11.jar:5.6.11]
	at org.elasticsearch.ingest.Pipeline.execute(Pipeline.java:58) ~[elasticsearch-5.6.11.jar:5.6.11]
	at org.elasticsearch.ingest.PipelineExecutionService.innerExecute(PipelineExecutionService.java:167) ~[elasticsearch-5.6.11.jar:5.6.11]
	at org.elasticsearch.ingest.PipelineExecutionService.access$000(PipelineExecutionService.java:41) ~[elasticsearch-5.6.11.jar:5.6.11]
	at org.elasticsearch.ingest.PipelineExecutionService$2.doRun(PipelineExecutionService.java:88) [elasticsearch-5.6.11.jar:5.6.11]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:675) [elasticsearch-5.6.11.jar:5.6.11]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.6.11.jar:5.6.11]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
Caused by: java.lang.IllegalArgumentException: ElasticsearchParseException[Error parsing document in field [data]]; nested: TikaException[Unexpected RuntimeException from org.apache.tika.parser.ParserDecorator$2@56c6f26e]; nested: NullPointerException;

```

ES version 5.6.11. I tried to open this directly in tika-app-18.jar and got same error.  
I can send docs if needed. Thanks.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 25, 2018, 6:36am UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/2 "2018-10-25T06:36:48Z")

</div>

Please provide the full stack trace, also the processor configuration and a reproducible example would be nice.

Lastly, can you verify if this error still happens in the newest version of Elasticsearch, being 6.4.2 at the time being.

Thanks.

---

<div class="post-metadata">

**Author:** ![7ca884569f2642e2c488](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7ca884569f2642e2c488/32/75102_2.png) [@7ca884569f2642e2c488](https://discuss.elastic.co/u/7ca884569f2642e2c488)\
**Post date:** [October 25, 2018, 7:40am UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/3 "2018-10-25T07:40:22Z")

</div>

Examples: [google drive zip file](https://drive.google.com/file/d/1HiObktdzcsJwgLILSdr6vh8oqzuDfFf0/view?usp=sharing)

Stack trace: [pastebin](https://pastebin.com/CHfFMc52)

Prosessor configuration: 2 x Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz, heap size 31GB

Sadly, I can't verify if this error still happens in the newest version of Elasticsearch at the moment because I can't easily upgrade to ver 6.4.2. Also I checked these files on the newest tika-app (1,19) and it failed too with the same error.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 25, 2018, 9:35am UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/4 "2018-10-25T09:35:20Z")

</div>

this indeed looks more like a tika issue judging from the stack trace. Would it be possible to create an example without elasticsearch and verify this happens, and then file a bug against tika?

---

<div class="post-metadata">

**Author:** ![Tim\_Allison](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@Tim\_Allison](https://discuss.elastic.co/u/Tim_Allison)\
**Post date:** [October 25, 2018, 10:02am UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/5 "2018-10-25T10:02:12Z")

</div>

Y. Please open an issue on Tika’s JIRA and I’ll take a look. We may be fairly close to the next POI release, and the fix is likely trivial.

---

<div class="post-metadata">

**Author:** ![7ca884569f2642e2c488](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7ca884569f2642e2c488/32/75102_2.png) [@7ca884569f2642e2c488](https://discuss.elastic.co/u/7ca884569f2642e2c488)\
**Post date:** [October 25, 2018, 12:27pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/6 "2018-10-25T12:27:05Z")

</div>

How to open an issue? I didn't find out how to do it on [https://issues.apache.org/jira/projects/TIKA/issues/](https://issues.apache.org/jira/projects/TIKA/issues/)

---

<div class="post-metadata">

**Author:** ![Tim\_Allison](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@Tim\_Allison](https://discuss.elastic.co/u/Tim_Allison)\
**Post date:** [October 25, 2018, 4:12pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/7 "2018-10-25T16:12:33Z")

</div>

Once you create an account, login and you’ll see a “create” issue button at the top.

---

<div class="post-metadata">

**Author:** ![Tim\_Allison](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@Tim\_Allison](https://discuss.elastic.co/u/Tim_Allison)\
**Post date:** [October 26, 2018, 5:50pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/8 "2018-10-26T17:50:25Z")

</div>

I opened this on POI's bugzilla: [https://bz.apache.org/bugzilla/show\_bug.cgi?id=62859](https://bz.apache.org/bugzilla/show_bug.cgi?id=62859)

Once I finish local integration tests, I'll commit the fix, which will make it into the next version of POI and Tika.

Thank you for sharing the full stacktrace!

---

<div class="post-metadata">

**Author:** ![7ca884569f2642e2c488](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7ca884569f2642e2c488/32/75102_2.png) [@7ca884569f2642e2c488](https://discuss.elastic.co/u/7ca884569f2642e2c488)\
**Post date:** [October 29, 2018, 8:00am UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/9 "2018-10-29T08:00:19Z")

</div>

Thank you! Do I still need to create an issue on JIRA after you created bug in bugzilla?

---

<div class="post-metadata">

**Author:** ![Tim\_Allison](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@Tim\_Allison](https://discuss.elastic.co/u/Tim_Allison)\
**Post date:** [October 29, 2018, 12:12pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/10 "2018-10-29T12:12:49Z")

</div>

If you are able to share the document, I’d be interested to see what structure led to an empty sdtcontent. I wasn’t able to replicate the npe by manually editing the xml. If you can’t share, all is ok. Thank you again.

---

<div class="post-metadata">

**Author:** ![7ca884569f2642e2c488](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7ca884569f2642e2c488/32/75102_2.png) [@7ca884569f2642e2c488](https://discuss.elastic.co/u/7ca884569f2642e2c488)\
**Post date:** [October 30, 2018, 11:42am UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/11 "2018-10-30T11:42:12Z")

</div>

I created an issue here [https://issues.apache.org/jira/browse/TIKA-2769](https://issues.apache.org/jira/browse/TIKA-2769). Is it ok?

---

<div class="post-metadata">

**Author:** ![Tim\_Allison](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@Tim\_Allison](https://discuss.elastic.co/u/Tim_Allison)\
**Post date:** [October 30, 2018, 2:26pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/12 "2018-10-30T14:26:36Z")

</div>

Y. Perfect...almost. See my comments there. Thank you!

---

<div class="post-metadata">

**Author:** ![Tim\_Allison](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@Tim\_Allison](https://discuss.elastic.co/u/Tim_Allison)\
**Post date:** [November 1, 2018, 9:20pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/13 "2018-11-01T21:20:30Z")

</div>

To close the loop here. Иван shared docs on the Tika JIRA issue that triggered: 1) an NPE and 2) a class cast exception.

I fixed the NPE in POI, and I just prevented the class cast exception for template/glossary documents.

POI doesn't currently support glossary documents, but we shouldn't through a ClassCastException! If you do want to extract info from glossary documents, you can use Tika's beta-level SAX parser for docx files.

Please see the Tika issue for references to the issues in POI.

Both of these fixes will be available in the next version of POI and Tika. POI should be out in the next few weeks.

Thank you, again, @7ca884569f2642e2c488 and @spinscale !

---

<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:** [November 29, 2018, 9:20pm UTC](https://discuss.elastic.co/t/error-while-using-ingest-attachment-plugin-on-some-docs/153836/14 "2018-11-29T21:20:31Z")

</div>

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