# Key format: does not match any supported format with a structured AVRO key

**URL:** <https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-with-a-structured-avro-key/7864>\
**Category:** ksqlDB\
**Created:** [14 May 2023 06:34 UTC](https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-with-a-structured-avro-key/7864 "2023-05-14T06:34:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://forum.confluent.io/u/Johannes)\
**Post date:** [14 May 2023 06:34 UTC](https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-with-a-structured-avro-key/7864/1 "2023-05-14T06:34:56Z")

</div>

```auto
ERROR: Key format: does not match any supported format. It may be a STRING with encoding other than UTF8, or some other format.
           key: \x00\x00\x00\x00\x94\x02\x1C10.10.10.10\x02Pff6204b2f1bf11eda05b0242ac120003,

```

I have a KSQL stream ip\_locator that reads data from an input stream (not our concern here) and selects two fields (ip and uaid) from the geolocation and user nested structures, respectively. This stream works fine and emits AVRO-formatted.

```auto
CREATE STREAM ip_locator
                WITH (VALUE_FORMAT='AVRO', KEY_FORMAT='KAFKA'', KAFKA_TOPIC='locator',PARTITIONS=4, REPLICAS=4) AS
                SELECT 
                	geolocation->ip as ip,
                	user->uaid as uaid
                FROM input
                EMIT CHANGES;

        ksql> print 'locator' FROM BEGINNING LIMIT 1;
        Key format: ¯\_(ツ)_/¯ - no data processed
        Value format: AVRO
        rowtime: 2022/04/4 11:13:33.131 Z, key: <null>, value: {"IP": "10.10.10.10", "UAID": "ff6204b2f1bf11eda05b0242ac120003"}, partition: 3
        Topic printing ceased

```

Now I want to create a new stream ip\_key that uses the same data from ip\_locator but sets the Kafka topic key as a composite structure with the ip and uaid fields. For this, I use the STRUCT function to build the key.

```auto
        CREATE STREAM ip_key
            WITH (FORMAT='AVRO', KAFKA_TOPIC='locator.key', PARTITIONS=4,REPLICAS=4) AS
            SELECT 
                STRUCT("ip":= ip, "uaid" := uaid) KEY,
                AS_VALUE(ip) as IP,
                AS_VALUE(uaid) as uaid,
            FROM ip_locator
  		    PARTITION BY STRUCT("ip":= ip, "uaid" := uaid)
            EMIT CHANGES;

```

However, when I try to print the Kafka topic locator.key that corresponds to the new stream, I get an error message saying that the key format is not recognized

```auto
            ksql> print 'locator.key' FROM BEGINNING LIMIT 3;
            Key format: does not match any supported format. It may be a STRING with encoding other than UTF8, or some other format.
            Value format: AVRO
            rowtime: 2022/04/4 11:13:33.131 Z, key: \x00\x00\x00\x00\x94\x02\x1C10.10.10.10\x02Pff6204b2f1bf11eda05b0242ac120003, value: {"IP": "10.10.10.10", "UAID": "ff6204b2f1bf11eda05b0242ac120003"}, partition: 3
            Topic printing ceased

```

```
Thank you for the help.

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [13 June 2023 06:35 UTC](https://forum.confluent.io/t/key-format-does-not-match-any-supported-format-with-a-structured-avro-key/7864/2 "2023-06-13T06:35:53Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
