# Configuration specified the fields \["topic"\], but they were not used

**URL:** <https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135>\
**Category:** Telegraf\
**Tags:** influxdb-cloud-2-0\
**Created:** [May 4, 2024, 8:47am UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135 "2024-05-04T08:47:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sin\_356](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sin_356/32/15567_2.png) [@sin\_356](https://community.influxdata.com/u/sin_356)\
**Post date:** [May 4, 2024, 8:47am UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135/1 "2024-05-04T08:47:34Z")

</div>

Hi i’m new to the telegraf and influxdb v2 (cloud). i have a problem regarding my configuration went i try to run it it said plugin inputs.mqtt\_consumer: line 38: configuration specified the fields [“topic”], but they were not used. This is either a typo or this config option does not exist in this version.  
what does the specified the field:[“topic”] mean, is there a incorrect placement went im configure the file?  
here is my complete configuration file (with my personal data ):  
[agent]  
interval = “20s”  
round\_interval = true  
metric\_batch\_size = 1000  
metric\_buffer\_limit = 10000  
collection\_jitter = “5s”  
flush\_interval = “10s”  
flush\_jitter = “5s”  
precision = “1ms”  
debug = false  
quiet = true  
logtarget = “file”  
logfile = “telegraflog”  
logfile\_rotation\_interval = “1d”  
logfile\_rotation\_max\_size = “0”  
logfile\_rotation\_max\_archives = -1  
log\_with\_timezone = “Asia/Jakarta”  
hostname = “”  
omit\_hostname = false  
[[outputs.influxdb\_v2]]  
urls =[“”]  
token = “”  
organization = “”  
bucket = “”

# bucket\_tag = “”

exclude\_bucket\_tag = false  
timeout = “600s”

# http\_headers = {“X-Special-Header” = “Special-Value”}

# http\_proxy = “[http://corporate.proxy:3128](http://corporate.proxy:3128)”

user\_agent = “telegraf”

# content\_encoding = “gzip”

# influx\_uint\_support = false

# tls\_ca = “/etc/telegraf/ca.pem”

# tls\_cert = “/etc/telegraf/cert.pem”

# tls\_key = “/etc/telegraf/key.pem”

# insecure\_skip\_verify = false

[[inputs.mqtt\_consumer]]

# example: servers = [“tcp://localhost:1883”]

# servers = [“ssl://localhost:1883”]

# servers = [“ws://localhost:1883”]

servers = []  
topics = [  
sensor/lokasi/#, ]  
topic\_tag = “”  
qos = 1  
connection\_timeout = “600s”  
max\_undelivered\_messages = 1000  
persistent\_session = true

client\_id = “”

username = “”  
password = “\<redacted”

# tls\_ca = “/etc/telegraf/ca.pem”

# tls\_cert = “/etc/telegraf/cert.pem”

# tls\_key = “/etc/telegraf/key.pem”

# insecure\_skip\_verify = false

data\_format = “influx”  
influx\_parser\_type = “internal”  
influx\_timestamp\_precision = “1ns”  
[[inputs.mqtt\_consumer.topic\_parsing]]  
topic = “sensor/lokasi/#”  
measurement = “Hasil\_Data”  
tags = “lokasi”  
fields = “CO2\_ppm”  
[[inputs.mqtt\_consumer.topic.types]]  
key = “CO2\_ppm”  
data\_type = “float”

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [May 4, 2024, 12:54pm UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135/2 "2024-05-04T12:54:07Z")

</div>

Hi,

It is really helpful to put your config between triple backticks ``` like so it renders it as text and not markdown to make it a bit easier to view.

> [[inputs.mqtt\_consumer.topic.types]]

This should not be an array of dictionaries, but a dictionary, you need to remove the extra brackets:

> [inputs.mqtt\_consumer.topic.types]

---

<div class="post-metadata">

**Author:** ![sin\_356](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sin_356/32/15567_2.png) [@sin\_356](https://community.influxdata.com/u/sin_356)\
**Post date:** [May 4, 2024, 1:13pm UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135/3 "2024-05-04T13:13:55Z")

</div>

ah thats why, and sorry for bad renders this is my first time asking about this kinda thing thx you for the advice

---

<div class="post-metadata">

**Author:** ![sin\_356](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sin_356/32/15567_2.png) [@sin\_356](https://community.influxdata.com/u/sin_356)\
**Post date:** [May 4, 2024, 1:43pm UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135/4 "2024-05-04T13:43:59Z")

</div>

after i change into what you told me the error its stil the same.  
here the configure you told me to change:

````auto
``` topic = "sensor/lokasi/#"
``` measurement = "Hasil_Data"
``` tags = "lokasi"
``` fields = "CO2_ppm"
```[inputs.mqtt_consumer.topic.types]
``` key = "CO2_ppm"
``` data_type = "float"
so i try the opposite of that by removing the extra bracket on 
```[[inputs.mqtt_consumer.topic_parsing]] 
this error happen afterward:
```error parsing mqtt_consumer, line 63: cannot unmarshal TOML table into []mqtt_consumer.TopicParsingConfig (need struct or map)
is this different problem?
````

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [May 4, 2024, 5:35pm UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135/5 "2024-05-04T17:35:13Z")

</div>

So order matters with TOML, the types come after topic\_parsing

Can you provide the full config + the output?

---

<div class="post-metadata">

**Author:** ![sin\_356](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sin_356/32/15567_2.png) [@sin\_356](https://community.influxdata.com/u/sin_356)\
**Post date:** [May 5, 2024, 5:23am UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135/6 "2024-05-05T05:23:23Z")

</div>

here you go  
[mqtt\_plugin\_sensor.txt](https://community.influxdata.com/uploads/short-url/4BulBCDUjrJc3TnW58XYXxBd6Di.txt) (1.9 KB)  
e  
and this is the outuput after i start it

```auto
error parsing mqtt_consumer, line 63: cannot unmarshal TOML table into []mqtt_consumer.TopicParsingConfig (need struct or map)
```

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [May 6, 2024, 1:28pm UTC](https://community.influxdata.com/t/configuration-specified-the-fields-topic-but-they-were-not-used/34135/7 "2024-05-06T13:28:12Z")

</div>

> [@jpowers](#):
>
> [inputs.mqtt\_consumer.topic.types]

Ah I missed this on saturday, it isn’t `topic` it is `topic_parsing`

> [inputs.mqtt\_consumer.topic\_parsing.types]

so based on what you provided in that file what you want is:

```toml
  [[inputs.mqtt_consumer.topic_parsing]]
    topic = "sensor/lokasi/#"
    measurement = "Hasil_Data"
    tags = "lokasi"
    fields = "CO2_ppm"

    [inputs.mqtt_consumer.topic_parsing.types]
        key = "CO2_ppm"
        data_type = "float"

```

I need to update the docs that is a bad typo. PR to update docs: [docs(inputs.mqtt\_consumer): Update topic parsing types naming by powersj · Pull Request #15301 · influxdata/telegraf · GitHub](https://github.com/influxdata/telegraf/pull/15301)
