# Invalid key type: 0 error during backups

**URL:** <https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484>\
**Category:** asbackup & asrestore\
**Created:** [August 10, 2017, 7:40am UTC](https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484 "2017-08-10T07:40:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerhard](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@gerhard](https://discuss.aerospike.com/u/gerhard)\
**Post date:** [August 10, 2017, 7:40am UTC](https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484/1 "2017-08-10T07:40:37Z")

</div>

Hello,

asbackup is logging the below errors, although the backup still completes. I’m planning to do a test restore to see if it succeeds and how much data is restored. What is causing this error and how can it be fixed? `Invalid key type` sounds critical

Errors:

```auto
2017-08-10 07:34:32 GMT [ERR] [20119] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20118] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20118] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20120] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20118] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20120] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20120] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20118] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0
2017-08-10 07:34:32 GMT [ERR] [20119] [src/main/aerospike/as_command.c:729][as_command_parse_key] Invalid key type: 0

```

command:

```auto
/usr/bin/asbackup --host xxx.xxx.xxx.xxx --namespace sports --verbose --nice 1 --priority 1 --directory /var/aerospike/2017-08-10-06-32-59_sports_backup

```

---

<div class="post-metadata">

**Author:** ![Albot](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/albot/32/2076_2.png) [@Albot](https://discuss.aerospike.com/u/Albot)\
**Post date:** [August 12, 2017, 4:47am UTC](https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484/2 "2017-08-12T04:47:59Z")

</div>

weeeird. no idea never seen it

---

<div class="post-metadata">

**Author:** ![Albot](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/albot/32/2076_2.png) [@Albot](https://discuss.aerospike.com/u/Albot)\
**Post date:** [August 13, 2017, 1:40am UTC](https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484/3 "2017-08-13T01:40:09Z")

</div>

out of curiosity… did the number of records backed up match what you’d expect? What was the final output? Did it have any number of “Failed” records?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [August 13, 2017, 2:32am UTC](https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484/4 "2017-08-13T02:32:29Z")

</div>

It is seeing a key type = 0 which is AS\_BYTES\_UNDEF. Its looking for AS\_BYTES\_INTEGER =1, \_STRING, \_DOUBLE, or \_BLOB for key type. Don’t know why that field is zero in your case.

---

<div class="post-metadata">

**Author:** ![tlo](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tlo](https://discuss.aerospike.com/u/tlo)\
**Post date:** [August 15, 2017, 5:59pm UTC](https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484/5 "2017-08-15T17:59:49Z")

</div>

Oh, wow. Interesting. May I ask a few further questions?

- Which version of the Aerospike server and `asbackup` does this happen with?

- Which Aerospike client (i.e., C, Java, etc.) and which client version does your application use to access the Aerospike server?

- Could you share the namespace configuration section for `sports` from your `aerospike.conf`? I’m mostly interested in seeing, whether the namespace is SSD-backed and whether reads come from memory (“data in memory”) or from SSD.

- Do you use sets? If you use sets, then does the issue affect the data in all sets or just a specific set? If it’s just a specific set, is there anything special about the keys used in this set?

Thank you!

---

<div class="post-metadata">

**Author:** ![gerhard](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@gerhard](https://discuss.aerospike.com/u/gerhard)\
**Post date:** [November 22, 2017, 9:51pm UTC](https://discuss.aerospike.com/t/invalid-key-type-0-error-during-backups/4484/6 "2017-11-22T21:51:43Z")

</div>

@tlo Sorry for delayed reply. Here are some answers to your questions.

> Which version of the Aerospike server and asbackup does this happen with?

```
$ asinfo -v version
Aerospike Community Edition build 3.9.1.1

```

`asbackup` - whatever came as standard with this version

> Which Aerospike client (i.e., C, Java, etc.) and which client version does your application use to access the Aerospike server?

GO and Ruby. Multiple different versions.

> Could you share the namespace configuration section for sports from your aerospike.conf? I’m mostly interested in seeing, whether the namespace is SSD-backed and whether reads come from memory (“data in memory”) or from SSD.

```
...
namespace sport_a {
        conflict-resolution-policy last-update-time
        replication-factor 2
        memory-size 64M
        default-ttl 24H
        #high-water-disk-pct 50
        high-water-memory-pct 60
        stop-writes-pct 90
        #ldt-enabled true
        storage-engine memory
}
namespace sport_b {
        conflict-resolution-policy last-update-time
        replication-factor 2
        memory-size 1G
        default-ttl 180d
        high-water-disk-pct 50
        high-water-memory-pct 60
        stop-writes-pct 90
        ldt-enabled true
        storage-engine device {
                file /opt/aerospike/data/sport_b.dat
                filesize 1G
                data-in-memory true
                write-block-size 512K
                defrag-lwm-pct 60
        }
}
namespace sport_c {
        conflict-resolution-policy last-update-time
        replication-factor 2
        memory-size 256M
        default-ttl 0
        high-water-disk-pct 50
        high-water-memory-pct 60
        stop-writes-pct 90
        ldt-enabled true
        storage-engine device {
                file /opt/aerospike/data/sport_c.dat
                filesize 1G
                data-in-memory true
                write-block-size 128K
                defrag-lwm-pct 60
                #cold-start-empty true
        }
}
namespace sport_d {
        conflict-resolution-policy last-update-time
        replication-factor 2
        memory-size 4G
        default-ttl 0
        high-water-disk-pct 50
        high-water-memory-pct 60
        stop-writes-pct 90
                
        migrate-sleep 2
        ldt-enabled true
        storage-engine device {
                file /opt/aerospike/data/sport_d.dat
                filesize 60G
                #data-in-memory true
                write-block-size 512K
                defrag-lwm-pct 60
                #cold-start-empty true
        }
}
namespace sport_e {
        conflict-resolution-policy last-update-time
        replication-factor 2
        memory-size 512M
        default-ttl 0
        high-water-disk-pct 50
        high-water-memory-pct 60
        stop-writes-pct 90
        #ldt-enabled true
        storage-engine device {
                file /opt/aerospike/data/sport_e.dat
                filesize 4G
                data-in-memory true
                write-block-size 128K
                defrag-lwm-pct 60
                #cold-start-empty true
        }
}
namespace sport_f {
        conflict-resolution-policy last-update-time
        replication-factor 2
        memory-size 512M
        default-ttl 0
        high-water-disk-pct 50
        high-water-memory-pct 60
        stop-writes-pct 90
        storage-engine device {
                file /opt/aerospike/data/sport_f.dat
                filesize 4G
                data-in-memory true
                write-block-size 128K
                defrag-lwm-pct 60
        }
}

```

Namespace `sport_d` is giving these errors.

> Do you use sets? If you use sets, then does the issue affect the data in all sets or just a specific set? If it’s just a specific set, is there anything special about the keys used in this set?

Yes, we use sets. I would have to back them up individually to see if error occurs in all of them.
