# Have an error message "Failed to derive xcontent from org.elasticsearch.common.bytes.ChannelBufferBytesReference", why?

**URL:** <https://discuss.elastic.co/t/have-an-error-message-failed-to-derive-xcontent-from-org-elasticsearch-common-bytes-channelbufferbytesreference-why/10167>\
**Category:** Elasticsearch\
**Created:** [December 24, 2012, 9:33am UTC](https://discuss.elastic.co/t/have-an-error-message-failed-to-derive-xcontent-from-org-elasticsearch-common-bytes-channelbufferbytesreference-why/10167 "2012-12-24T09:33:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asoqa](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@asoqa](https://discuss.elastic.co/u/asoqa)\
**Post date:** [December 24, 2012, 9:33am UTC](https://discuss.elastic.co/t/have-an-error-message-failed-to-derive-xcontent-from-org-elasticsearch-common-bytes-channelbufferbytesreference-why/10167/1 "2012-12-24T09:33:56Z")

</div>

I used bulk api with php, but met a problem:  
{"error":"Failed to derive xcontent from  
org.elasticsearch.common.bytes.ChannelBufferBytesReference

here is my curl command:  
curl -s -XPOST localhost:9200/\_bulk --data-binary @requests;

php code:

\<?php $method = "POST"; $url = "http://localhost/\_bulk"; $data = array('file' =\> '@requests'); $ch = curl\_init(); curl\_setopt($ch, CURLOPT\_URL, $url); curl\_setopt($ch, CURLOPT\_PORT, 9200); curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1); curl\_setopt($ch, CURLOPT\_CUSTOMREQUEST, strtoupper($method)); curl\_setopt($ch, CURLOPT\_POST, true); curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data); $result = curl\_exec($ch); curl\_close($ch); print\_r($result); --

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 24, 2012, 1:45pm UTC](https://discuss.elastic.co/t/have-an-error-message-failed-to-derive-xcontent-from-org-elasticsearch-common-bytes-channelbufferbytesreference-why/10167/2 "2012-12-24T13:45:14Z")

</div>

You send an empty file. Check the file name usage.

Jörg

--

---

<div class="post-metadata">

**Author:** ![asoqa](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@asoqa](https://discuss.elastic.co/u/asoqa)\
**Post date:** [December 25, 2012, 2:40am UTC](https://discuss.elastic.co/t/have-an-error-message-failed-to-derive-xcontent-from-org-elasticsearch-common-bytes-channelbufferbytesreference-why/10167/3 "2012-12-25T02:40:14Z")

</div>

I think you are right. But how to fix my php code's bug?

在 2012年12月24日星期一UTC+8下午9时45分14秒，Jörg Prante写道：

> You send an empty file. Check the file name usage.
> 
> Jörg

--

---

<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:** [July 6, 2017, 2:58am UTC](https://discuss.elastic.co/t/have-an-error-message-failed-to-derive-xcontent-from-org-elasticsearch-common-bytes-channelbufferbytesreference-why/10167/4 "2017-07-06T02:58:32Z")

</div>


