Skip to content

Error message when loading config with duplicate toml key prints line number in hexadecimal #11052

@reimda

Description

@reimda

Relevant telegraf.conf

#lots of lines removed here
[[inputs.file]]
  name_override = "thermometer"
  files = ["community-24806.xml"]
  data_format = "xml"  
 
  [[inputs.file.xml]]
    metric_selection = "/root/*[starts-with(name(),'ch')]"
    timestamp = "root/timeunix"
    [inputs.file.xml.tags]
      devname = "string(/root/devname)"
      sensor = "substring-after(name(), 'ch')" # line 106
      sensor = "name" # line 107

Logs from Telegraf

$ ../telegraf -config telegraf.conf.24806
2022-04-29T20:51:13Z E! [telegraf] Error running agent: Error loading config file telegraf.conf.24806: Error parsing data: line 107: key `sensor' is in conflict with line 6ad

System info

today's master branch

Docker

No response

Steps to reproduce

I triggered it using a file input and xml parser with two tags, both named "sensor"

Expected behavior

Both line numbers in the error message are in decimal. In my example the duplicate keys are on line 106 and 107.

Actual behavior

One line number in the error message is in decimal (107 in my example) and the other is in hex (6a in the example, which is 106 decimal)

Additional info

No response

Metadata

Metadata

Assignees

Labels

area/xmlbugunexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions