Start a new topic

Save returns onFailure but entity does get saved in the collection....

I have a strange case. I am doing a save of an entity in a collection and even though the entity gets saved correctly to Kinvey backend, the onFailure gets called instead of onSuccess with the following error message:


E/KINVEY_SUMMARY(11858): REASON: Unable to parse the JSON in the response

E/KINVEY_SUMMARY(11858): FIX: examine BL or DLC to ensure data format is correct. If the exception is caused by `key <somkey>`, then <somekey> might be a different type than is expected (int instead of of string)

E/KINVEY_SUMMARY(11858): EXPLANATION: java.lang.IllegalArgumentException: 




E/KINVEY_SUMMARY(11858): at$1.execute(


E/KINVEY_SUMMARY(11858): at$SaveRequest.executeAsync(


E/KINVEY_SUMMARY(11858): at android.os.AsyncTask$


E/KINVEY_SUMMARY(11858): at$KinveySerialExecutor$

E/KINVEY_SUMMARY(11858): at java.util.concurrent.ThreadPoolExecutor.runWorker(

E/KINVEY_SUMMARY(11858): at java.util.concurrent.ThreadPoolExecutor$


I am unable to figure out how to go about fixing this issue or whats the issue in the first place.

1 person has this question


Can you give us some steps to reproduce this issue?



Here is the detailed log. I am not sure why the JSON parse in response is failing as the response JSOn seems to be valid and I am using GenericJson in the callback:

07-28 16:04:27.587 D/HttpTransport( 8764): -------------- REQUEST --------------

07-28 16:04:27.587 D/HttpTransport( 8764): POST

07-28 16:04:27.587 D/HttpTransport( 8764): Accept-Encoding: gzip

07-28 16:04:27.587 D/HttpTransport( 8764): Authorization: <Not Logged>

07-28 16:04:27.587 D/HttpTransport( 8764): Content-Type: application/json; charset=UTF-8

07-28 16:04:27.587 D/HttpTransport( 8764): User-Agent: android-kinvey-http/2.9.5

07-28 16:04:27.587 D/HttpTransport( 8764): x-kinvey-api-version: 3

07-28 16:04:27.587 D/HttpTransport( 8764): x-kinvey-device-information: Asus/Nexus_7 Android 4.2.2 0e0a9175-c3fc-37fc-b36e-0c6d65df3756

07-28 16:04:27.587 D/HttpTransport( 8764): Content-Type: application/json; charset=UTF-8

07-28 16:04:27.587 D/HttpTransport( 8764): Content-Length: 126

07-28 16:04:27.587 D/HttpTransport( 8764): curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'Authorization: <Not Logged>' -H 'Content-Type: application/json; charset=UTF-8' -H 'User-Agent: android-kinvey-http/2.9.5' -H 'x-kinvey-api-version: 3' -H 'x-kinvey-device-information: Asus/Nexus_7 Android 4.2.2 0e0a9175-c3fc-37fc-b36e-0c6d65df3756' -H 'Content-Type: application/json; charset=UTF-8' -d '@-' -- '' << $$$

07-28 16:04:27.587 D/HttpTransport( 8764): Total: 126 bytes

07-28 16:04:27.587 D/HttpTransport( 8764): {"condition":{"is_fixed":false},"initial":{"_result":0},"key":{"severity":true},"reduce":"function(doc,out){ out._result++;}"}

07-28 16:04:27.957 D/HttpTransport( 8764): -------------- RESPONSE --------------

07-28 16:04:27.957 D/HttpTransport( 8764): 200 OK

07-28 16:04:27.957 D/HttpTransport( 8764): Content-Length: 166

07-28 16:04:27.957 D/HttpTransport( 8764): Content-Type: application/json; charset=utf-8

07-28 16:04:27.957 D/HttpTransport( 8764): Date: Tue, 28 Jul 2015 10:34:29 GMT

07-28 16:04:27.957 D/HttpTransport( 8764): Server: ngx_openresty

07-28 16:04:27.957 D/HttpTransport( 8764): X-Android-Received-Millis: 1438079667953

07-28 16:04:27.957 D/HttpTransport( 8764): X-Android-Sent-Millis: 1438079667594

07-28 16:04:27.957 D/HttpTransport( 8764): X-Kinvey-API-Version: 3

07-28 16:04:27.957 D/HttpTransport( 8764): X-Kinvey-Request-Id: 6aaec528b3a94fd58e6c1cbb3860f08e

07-28 16:04:27.957 D/HttpTransport( 8764): X-Powered-By: Express

07-28 16:04:27.957 D/HttpTransport( 8764): Total: 166 bytes

07-28 16:04:27.957 D/HttpTransport( 8764): [{"severity":"ERROR","_result":62},{"severity":"WARN","_result":86},{"severity":"INFO","_result":18},{"severity":"FATAL","_result":15},{"severity":"LOW","_result":1}]

07-28 16:04:27.957 E/Kinvey - Client( 8764): unable to parse response -> java.lang.IllegalArgumentException:

That always happens to me. If it carries on I have to stop using kinvey :/


Can you share the code that is causing you to experience this issue?


Hello Pankaj,  

Can you enable debugging as outlined in:

If you are running an older version of the library there may be a different process to enable debug logging.


Using count function to do aggregation is the simplest way to reproduce it as that returns a json array as can be seen from the log I have added. The count function works fine on iOS, backbone, REST etc but fails with "unable to parse response" error on android. Can you confirm that count is working fine for you on android?




I'm running into the exact same issue. Testing the code provided on the website I get this error when trying to fetch all:

D/dalvikvm: newInstance failed: no <init>()

D/dalvikvm: GC_CONCURRENT freed 1905K, 11% free 19253K/21511K, paused 11ms+0ms, total 21ms

D/OpenGLRenderer: TextureCache::get: create texture(0xb8dfe200): name, size, mSize = 176, 777600, 7995600

E/TAG: failed to fetch all

       REASON: Unable to parse the JSON in the response

       FIX: examine BL or DLC to ensure data format is correct. If the exception is caused by `key <somkey>`, then <somekey> might be a different type than is expected (int instead of of string)

       EXPLANATION: java.lang.IllegalArgumentException:

Code below. 

If I use a non existing collection it returns 0 and there is no error.



final AsyncAppData<EventEntity> myevents = mKinveyClient.appData("Concerts", EventEntity.class);
myevents.get(new KinveyListCallback<EventEntity>() {

    public void onSuccess(EventEntity[] result) {
        Log.v("TAG", "received "+ result.length + " events");
    public void onFailure(Throwable error)  {
        Log.e("TAG", "failed to fetch all", error);
public class EventEntity extends GenericJson {
      private String id;
        private String concertName;
        private String concertLink;
        private String imgLink;
//        @Key("_kmd")
//        private KinveyMetaData meta; // Kinvey metadata, OPTIONAL
//        @Key("_acl")
//        private KinveyMetaData.AccessControlList acl; //Kinvey access control, OPTIONAL

        public EventEntity(){}  //GenericJson classes must have a public empty constructor




Can you enable debug mode as outlined in the troubleshooting guide in the devcenter and let me see the requests that lead up to this issue.


I did some more digging and it seems the issue comes when the response has a json array as part of the packet. The easiest way to get to the problem is to use the aggregation and grouping stuff on android. I can confirm that it works fine on iOS. 

Login or Signup to post a comment