{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/824","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/824/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/824/comments","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/824/events","html_url":"https://github.com/couchbase/couchbase-lite-ios/issues/824","id":97311711,"number":824,"title":"CBLPusher bad_request error 400 Missing digest in stub attachment","user":{"login":"pahmed","id":5355138,"avatar_url":"https://avatars.githubusercontent.com/u/5355138?v=3","gravatar_id":"","url":"https://api.github.com/users/pahmed","html_url":"https://github.com/pahmed","followers_url":"https://api.github.com/users/pahmed/followers","following_url":"https://api.github.com/users/pahmed/following{/other_user}","gists_url":"https://api.github.com/users/pahmed/gists{/gist_id}","starred_url":"https://api.github.com/users/pahmed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pahmed/subscriptions","organizations_url":"https://api.github.com/users/pahmed/orgs","repos_url":"https://api.github.com/users/pahmed/repos","events_url":"https://api.github.com/users/pahmed/events{/privacy}","received_events_url":"https://api.github.com/users/pahmed/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/f:%20Replication","name":"f: Replication","color":"f8e100"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/needsmoreinfo","name":"needsmoreinfo","color":"0052cc"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/review","name":"review","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-26T12:11:54Z","updated_at":"2015-07-31T22:57:20Z","closed_at":null,"body":"Hi, I see an error that frequently appears from the CBLPusher, which causes the document not to be synced with the sync-gateway\r\n\r\n```\r\nWARNING: CBLRestPusher[https://xxxxx.xxxxx.com:443/xxxx]: _bulk_docs got an error: {\r\n    error = \"bad_request\";\r\n    id = \"contact:A1BB65C1-DC31-43F9-A1B3-9935CE6B6DCC\";\r\n    reason = \"Missing digest in stub attachment \\\"small_picture:C2A50F35-BAC4-4CB7-9720-F8B5C55C1CD0\\\"\";\r\n    status = 400;\r\n}\r\n```\r\ni checked the `_attachments` for that document and found that the digest for `small_picture:C2A50F35-BAC4-4CB7-9720-F8B5C55C1CD0` exists\r\n\r\nwhenever this error appears, i see this one also:\r\n```\r\nDomain=CBLHTTP Code=400 \"400 bad_request\" UserInfo=0x7fd437b233c0 {NSURL=https://xxxxx.xxxxx.com:443/xxxx/contact:A1BB65C1-DC31-43F9-A1B3-9935CE6B6DCC, NSLocalizedFailureReason=bad_request, NSLocalizedDescription=400 bad_request}\r\n```\r\n\r\nThe error happens on version `1.1`, i tried also the master branch and the same problem exists, BUT this problem does not happen in version `1.0.3`\r\n\r\nThis is the document:\r\n\r\n```\r\n{\r\n    \"_attachments\" =     {\r\n        \"large_picture:7FCEE8FB-97F4-4D11-80A6-08DD787B3A4B\" =         {\r\n            \"content_type\" = \"image/jpeg\";\r\n            digest = \"sha1-7zigjZkX0y9ZhpW2ENt85ldePQI=\";\r\n            length = 826850;\r\n            revpos = 1;\r\n            stub = 1;\r\n        };\r\n        \"small_picture:C2A50F35-BAC4-4CB7-9720-F8B5C55C1CD0\" =         {\r\n            \"content_type\" = \"image/jpeg\";\r\n            digest = \"sha1-+Lgl0qT8Vt2YDxjqCn+e4lnfgSg=\";\r\n            length = 15451;\r\n            revpos = 1;\r\n            stub = 1;\r\n        };\r\n    };\r\n    \"_id\" = \"contact:A1BB65C1-DC31-43F9-A1B3-9935CE6B6DCC\";\r\n    \"_rev\" = \"5-452d89f8849bab4758014458e7870e55\";\r\n    act = \"contact:9cbc445b-61cd-4ff5-aef7-e0019e91b7e4_9cbc445b-61cd-4ff5-aef7-e0019e91b7e4\";\r\n    acn =     {\r\n        primary =         {\r\n            \"_state\" = 0;\r\n            first = xxxx;\r\n            last = xxxx;\r\n            modifiedAt = 1437664925795;\r\n            visibility = 2;\r\n        };\r\n    };\r\n    ad =     (\r\n    );\r\n    av =     {\r\n        \"_state\" = 6;\r\n        large = \"large_picture:7FCEE8FB-97F4-4D11-80A6-08DD787B3A4B\";\r\n        modifiedAt = 1437828543453;\r\n        small = \"small_picture:C2A50F35-BAC4-4CB7-9720-F8B5C55C1CD0\";\r\n        visibility = 2;\r\n    };\r\n    da =     (\r\n    );\r\n    docState = new;\r\n    em =     (\r\n                {\r\n            \"_state\" = 0;\r\n            isActive = 1;\r\n            modifiedAt = 12345;\r\n            primary = 0;\r\n            type = xxxx;\r\n            value = \"xxxx\";\r\n            verified = 1;\r\n            visibility = 2;\r\n        }\r\n    );\r\n    inm =     (\r\n    );\r\n    isA = 1;\r\n    isL = 0;\r\n    isO = 0;\r\n    lUBy = n;\r\n    lIds =     (\r\n        \"contact:0AEA67FF-C924-4F86-BE32-F60D351996E2\",\r\n        \"contact:9cbc445b-61cd-4ff5-aef7-e0019e91b7e4_9cbc445b-61cd-4ff5-aef7-e0019e91b7e4\"\r\n    );\r\n    locations =     {\r\n        c =         {\r\n            \"_state\" = 0;\r\n            country = xxx;\r\n            modifiedAt = 23123123;\r\n            timezone = \"xxx/xxx\";\r\n            visibility = 2;\r\n        };\r\n        h =         {\r\n            \"_state\" = 0;\r\n            country = xxx;\r\n            modifiedAt = 24234234;\r\n            timezone = \"xxx/xxx\";\r\n            visibility = 2;\r\n        };\r\n    };\r\n    names =     {\r\n        primary =         {\r\n            \"_state\" = 6;\r\n            first = xxxx;\r\n            last = xxxx;\r\n            modifiedAt = 1437824591807;\r\n            visibility = 2;\r\n        };\r\n    };\r\n    organizations =     (\r\n                {\r\n            \"_state\" = 6;\r\n            department = \"\";\r\n            isActive = 1;\r\n            modifiedAt = 234234234;\r\n            name = \"\";\r\n            title = \"\";\r\n            visibility = 2;\r\n        }\r\n    );\r\n    owner = \"9cbc445b-61cd-4ff5-aef7-e0019e91b7e4\";\r\n    ph =     (\r\n                {\r\n            \"_state\" = 0;\r\n            isActive = 1;\r\n            mo = \"xxxx\";\r\n            modifiedAt = 1437664925792;\r\n            primary = 0;\r\n            type = xxxx;\r\n            value = \"xxxxxx\";\r\n            verified = 0;\r\n            visibility = 2;\r\n        },\r\n                {\r\n            \"_state\" = 0;\r\n            mo = \"xxxxx\";\r\n            modifiedAt = 1437824591813;\r\n            primary = 0;\r\n            type = mo;\r\n            value = \"xxxx\";\r\n            verified = 0;\r\n            visibility = 2;\r\n        },\r\n                {\r\n            \"_state\" = 0;\r\n            isActive = 1;\r\n            modifiedAt = 1437817747736;\r\n            primary = 0;\r\n            type = mo;\r\n            value = \"xxxx\";\r\n            verified = 0;\r\n            visibility = 2;\r\n        },\r\n                {\r\n            \"_state\" = 0;\r\n            isActive = 1;\r\n            modifiedAt = 1437825168292;\r\n            primary = 0;\r\n            type = mo;\r\n            value = \"xxxx\";\r\n            verified = 0;\r\n            visibility = 2;\r\n        }\r\n    );\r\n    related =     (\r\n    );\r\n    rena =     (\r\n        \"xxxx\",\r\n        \"xxxx\"\r\n    );\r\n    soc =     (\r\n                {\r\n            \"_state\" = 0;\r\n            display = \"xxxx\";\r\n            id = xxxx;\r\n            isActive = 1;\r\n            modifiedAt = 1437664925802;\r\n            profilePictureURL = \"xxxx\";\r\n            provider = xxxx;\r\n            verified = 1;\r\n            visibility = 2;\r\n        }\r\n    );\r\n    type = contact;\r\n    urls =     (\r\n    );\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/comments/126830789","html_url":"https://github.com/couchbase/couchbase-lite-ios/issues/824#issuecomment-126830789","issue_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/824","id":126830789,"user":{"login":"pahmed","id":5355138,"avatar_url":"https://avatars.githubusercontent.com/u/5355138?v=3","gravatar_id":"","url":"https://api.github.com/users/pahmed","html_url":"https://github.com/pahmed","followers_url":"https://api.github.com/users/pahmed/followers","following_url":"https://api.github.com/users/pahmed/following{/other_user}","gists_url":"https://api.github.com/users/pahmed/gists{/gist_id}","starred_url":"https://api.github.com/users/pahmed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pahmed/subscriptions","organizations_url":"https://api.github.com/users/pahmed/orgs","repos_url":"https://api.github.com/users/pahmed/repos","events_url":"https://api.github.com/users/pahmed/events{/privacy}","received_events_url":"https://api.github.com/users/pahmed/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T22:57:20Z","updated_at":"2015-07-31T22:57:20Z","body":"I'm using sync gateway, this is the same problem for different document, i've included the client & server versions for the document\r\n\r\nWARNING: CBL_Pusher[https://xxx.xxx.com:443/xxx]: _bulk_docs got an error: {\r\n    error = \"bad_request\";\r\n    id = \"profile:fe9356eb-0359-4902-b685-93def64d7349\";\r\n    reason = \"Missing digest in stub attachment \\\"small_picture:A7165BE2-0E6C-4CCE-BB95-2DB546833D31\\\"\";\r\n    status = 400;\r\n}\r\n\r\nError Domain=CBLHTTP Code=400 \"400 bad_request\" UserInfo=0x170f7250 {NSURL=https://xxx.xxx.com:443/xxx/profile:fe9356eb-0359-4902-b685-93def64d7349, NSLocalizedFailureReason=bad_request, NSLocalizedDescription=400 bad_request}\r\n\r\n\r\nClient version:\r\n```\r\n{\r\n    \"_attachments\" =     {\r\n        \"large_picture:7BD0D1F2-0875-434B-8B6D-580EA0A3E79E\" =         {\r\n            \"content_type\" = \"image/jpeg\";\r\n            digest = \"sha1-z6b81tk6EhsR1eDCEya79YZxpSc=\";\r\n            length = 60293;\r\n            revpos = 2;\r\n            stub = 1;\r\n        };\r\n        \"small_picture:A7165BE2-0E6C-4CCE-BB95-2DB546833D31\" =         {\r\n            \"content_type\" = \"image/jpeg\";\r\n            digest = \"sha1-z6b81tk6EhsR1eDCEya79YZxpSc=\";\r\n            length = 60293;\r\n            revpos = 2;\r\n            stub = 1;\r\n        };\r\n    };\r\n    \"_id\" = \"profile:fe9356eb-0359-4902-b685-93def64d7349\";\r\n    \"_rev\" = \"13-5a614058a186d9b22c519bc44794159f\";\r\n    \"_revisions\" =     {\r\n        ids =         (\r\n            7d2c424e33eef5251e2ee79e5da395a1,\r\n            1d99391b4125a141e57c9b9c3b78256c,\r\n            e558748924cd7d0ebdef9c941acd7149,\r\n            eba8eb0c572c9a6febfdba4f29e053df,\r\n            901c94663d41a644d5afb33225c01f74,\r\n            d8b024791e3dd52d469d88bf7714abe5,\r\n            a28ea27834dc41a7b96aba5a07f99205,\r\n            e082784e9e292cd1118abb6b3950034f,\r\n            ad77b8bc6a85da011af9177cc0015c2f,\r\n            29624f4d599ea57a874006d8b579c96a,\r\n            c7c6c71ec400d8dcb3ba1c01c7791121\r\n        );\r\n        start = 11;\r\n    };\r\n    avatars =     {\r\n        \"_state\" = 0;\r\n        isRandom = 0;\r\n        large = \"large_picture:7BD0D1F2-0875-434B-8B6D-580EA0A3E79E\";\r\n        modifiedAt = 1438168194236;\r\n        small = \"small_picture:A7165BE2-0E6C-4CCE-BB95-2DB546833D31\";\r\n        visibility = 2;\r\n    };\r\n    createdAt = 1438168143882;\r\n    docState = dirty;\r\n    emails =     (\r\n                {\r\n            \"_state\" = 0;\r\n            modifiedAt = 1438168143448;\r\n            primary = 0;\r\n            type = home;\r\n            value = \"xxx\";\r\n            verified = 1;\r\n            visibility = 2;\r\n        },\r\n                {\r\n            \"_state\" = 7;\r\n            modifiedAt = 1438170704332;\r\n            primary = 0;\r\n            type = personal;\r\n            value = \"wwww@w.w\";\r\n            verified = 0;\r\n            visibility = 2;\r\n        },\r\n                {\r\n            \"_deleted\" = 1;\r\n            \"_state\" = 4;\r\n            modifiedAt = 1438170601075;\r\n            primary = 0;\r\n            type = personal;\r\n            value = \"q@q.qqq\";\r\n            verified = 0;\r\n            visibility = 2;\r\n        }\r\n    );\r\n    isActive = 0;\r\n    locations =     {\r\n        current =         {\r\n            \"_state\" = 0;\r\n            country = xxx;\r\n            modifiedAt = 1438168143476;\r\n            timezone = \"Europe/Amsterdam\";\r\n            visibility = 2;\r\n        };\r\n        home =         {\r\n            \"_state\" = 0;\r\n            country = xxx;\r\n            modifiedAt = 1438168143476;\r\n            timezone = \"Europe/Amsterdam\";\r\n            visibility = 2;\r\n        };\r\n    };\r\n    names =     {\r\n        primary =         {\r\n            \"_state\" = 0;\r\n            first = xxx;\r\n            last = xxx;\r\n            modifiedAt = 1438168143475;\r\n            visibility = 2;\r\n        };\r\n    };\r\n    organizations =     (\r\n                {\r\n            \"_state\" = 0;\r\n            department = \"\";\r\n            modifiedAt = 1438168641337;\r\n            name = \"\";\r\n            title = \"\";\r\n            visibility = 2;\r\n        }\r\n    );\r\n    phones =     (\r\n                {\r\n            \"_state\" = 0;\r\n            mobile = \"+201005219056\";\r\n            modifiedAt = 1438168143464;\r\n            primary = 0;\r\n            type = mobile;\r\n            value = \"xxx\";\r\n            verified = 0;\r\n            visibility = 2;\r\n        }\r\n    );\r\n    socialAccounts =     (\r\n                {\r\n            \"_state\" = 0;\r\n            display = \"xxx\";\r\n            id = 1018908587;\r\n            modifiedAt = 1438168143490;\r\n            profilePictureURL = \"xxx\";\r\n            provider = xxx;\r\n            verified = 1;\r\n            visibility = 2;\r\n        }\r\n    );\r\n}\r\n```\r\n===================\r\n\r\nServer version:\r\n```\r\n{\r\n  \"_attachments\": {\r\n    \"large_picture:7BD0D1F2-0875-434B-8B6D-580EA0A3E79E\": {\r\n      \"content_type\": \"image/jpeg\",\r\n      \"digest\": \"sha1-z6b81tk6EhsR1eDCEya79YZxpSc=\",\r\n      \"length\": 60293,\r\n      \"revpos\": 2,\r\n      \"stub\": true\r\n    },\r\n    \"small_picture:A7165BE2-0E6C-4CCE-BB95-2DB546833D31\": {\r\n      \"content_type\": \"image/jpeg\",\r\n      \"digest\": \"sha1-z6b81tk6EhsR1eDCEya79YZxpSc=\",\r\n      \"length\": 60293,\r\n      \"revpos\": 2,\r\n      \"stub\": true\r\n    }\r\n  },\r\n  \"_id\": \"profile:fe9356eb-0359-4902-b685-93def64d7349\",\r\n  \"_rev\": \"13-fd8f6f260da721e9838cad9a64088770\",\r\n  \"avatars\": {\r\n    \"_state\": 0,\r\n    \"isRandom\": false,\r\n    \"large\": \"large_picture:7BD0D1F2-0875-434B-8B6D-580EA0A3E79E\",\r\n    \"modifiedAt\": 1438168194236,\r\n    \"small\": \"small_picture:A7165BE2-0E6C-4CCE-BB95-2DB546833D31\",\r\n    \"visibility\": 2\r\n  },\r\n  \"createdAt\": 1438168143882,\r\n  \"docState\": \"pristine\",\r\n  \"emails\": [\r\n    {\r\n      \"_state\": 0,\r\n      \"modifiedAt\": 1438168143448,\r\n      \"primary\": false,\r\n      \"type\": \"home\",\r\n      \"value\": \"xxx\",\r\n      \"verified\": true,\r\n      \"visibility\": 2\r\n    },\r\n    {\r\n      \"_deleted\": true,\r\n      \"_state\": 4,\r\n      \"modifiedAt\": 1438170601075,\r\n      \"primary\": false,\r\n      \"type\": \"personal\",\r\n      \"value\": \"q@q.qqq\",\r\n      \"verified\": false,\r\n      \"visibility\": 2\r\n    },\r\n    {\r\n      \"_state\": 0,\r\n      \"modifiedAt\": 1438170704332,\r\n      \"primary\": false,\r\n      \"type\": \"personal\",\r\n      \"value\": \"wwww@w.w\",\r\n      \"verified\": false,\r\n      \"visibility\": 2\r\n    }\r\n  ],\r\n  \"isActive\": 0,\r\n  \"locations\": {\r\n    \"current\": {\r\n      \"_state\": 0,\r\n      \"country\": \"xxx\",\r\n      \"modifiedAt\": 1438168143476,\r\n      \"timezone\": \"Europe/Amsterdam\",\r\n      \"visibility\": 2\r\n    },\r\n    \"home\": {\r\n      \"_state\": 0,\r\n      \"country\": \"xxx\",\r\n      \"modifiedAt\": 1438168143476,\r\n      \"timezone\": \"Europe/Amsterdam\",\r\n      \"visibility\": 2\r\n    }\r\n  },\r\n  \"names\": {\r\n    \"primary\": {\r\n      \"_state\": 0,\r\n      \"first\": \"xxx\",\r\n      \"last\": \"xxx\",\r\n      \"modifiedAt\": 1438168143475,\r\n      \"visibility\": 2\r\n    }\r\n  },\r\n  \"organizations\": [\r\n    {\r\n      \"_state\": 0,\r\n      \"department\": \"\",\r\n      \"modifiedAt\": 1438168641337,\r\n      \"name\": \"\",\r\n      \"title\": \"\",\r\n      \"visibility\": 2\r\n    }\r\n  ],\r\n  \"phones\": [\r\n    {\r\n      \"_state\": 0,\r\n      \"mobile\": \"xxx\",\r\n      \"modifiedAt\": 1438168143464,\r\n      \"primary\": false,\r\n      \"type\": \"mobile\",\r\n      \"value\": \"xxx\",\r\n      \"verified\": false,\r\n      \"visibility\": 2\r\n    }\r\n  ],\r\n  \"socialAccounts\": [\r\n    {\r\n      \"_state\": 0,\r\n      \"display\": \"xxx\",\r\n      \"id\": \"1018908587\",\r\n      \"modifiedAt\": 1438168143490,\r\n      \"profilePictureURL\": \"xxx\",\r\n      \"provider\": \"xxx\",\r\n      \"verified\": true,\r\n      \"visibility\": 2\r\n    }\r\n  ]\r\n}\r\n```"}}