PHP - incrementing bins, occasional Error Code 12: Bin type error

We are using the most recent PHP driver (3.4.14)

About a month ago, we ran into an issue where we got the “Error Code 12: Bin Type Error”. The record was created by the increment method. After receiving the error, we looked at the record, and the value in the bin was 0, rather than what it should have been (some integer). We continued to get the same error when repeating the operation. Deleting the record and retrying solved the issue.

We had the issue one more time a few weeks later. Now we’ve just had it several times in the last few days. Below are some of the lines from the error log that I think are pertinent. It looks like the first two, the value in the bin was a float, and we tried to increment it with an integer, and the third one the value was an integer, and we tried to increment it with a float.

Apr 03 2017 21:18:25 GMT: WARNING (particle): (particle_float.c:112) increment with non float type 1
Apr 03 2017 21:18:25 GMT: WARNING (rw): (write.c:1716) {prod} write_master: failed as_bin_particle_alloc_modify_from_client() <Digest>:0xbdb8733980c8372df4f9596403271ef264154eb2

Apr 03 2017 21:18:44 GMT: WARNING (particle): (particle_float.c:112) increment with non float type 1
Apr 03 2017 21:18:44 GMT: WARNING (rw): (write.c:1716) {prod} write_master: failed as_bin_particle_alloc_modify_from_client() <Digest>:0xbdb8733980c8372df4f9596403271ef264154eb2

Apr 04 2017 13:36:03 GMT: WARNING (particle): (particle_integer.c:147) increment with non integer type 2
Apr 04 2017 13:36:03 GMT: WARNING (rw): (write.c:1716) {prod} write_master: failed as_bin_particle_alloc_modify_from_client() <Digest>:0x189015a900b38c47251df3da86ab7aab7807ae51

The interesting thing is that we only have one place in our codebase that does the increment process, and it casts the value to an int before incrementing the bin. (Code below)

$key = $this->aerospike->initKey($namespace, $set, $keyString);
$amountToStore = (int) $amount;
$status = $this->aerospike->increment(
    $key,
    $bin,
    $amountToStore
);

Has anyone else run into this before?