Error writing to outputs.influxdb_v2 with 422 Unprocessable Entity

I’ve written a pretty small telegraf file to pull data from Solar Assistant into/through Influxdb and telegraf for output into Grafana. The file works well enough and my Grafana output is just what I need. The issue comes in the telegraf logs showing the following issues. I can’t find the offending code. As I said, I’m getting data through just fine but I’d like to understand my error before I try more complex point projects.

When I ask:

docker logs telegraf --tail 50, I get this (just a portion of the issue but representative)

2025-11-17T15:14:15Z E! [agent] Error writing to outputs.influxdb_v2: failed to write metrics to solar_data (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: field type conflict: input field “value” on measurement “mqtt_consumer” is type string, already exists as type float dropped=5

2025-11-17T15:14:25Z E! [outputs.influxdb_v2] When writing to [http://192.168.5.172:8086/api/v2/write\\\\]: failed to write metrics to solar_data (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: field type conflict: input field “value” on measurement “mqtt_consumer” is type string, already exists as type float dropped=4

My telegraf.conf (redacted)

[agent]

interval = “15s”

debug = true

[[inputs.cpu]]

percpu = true

totalcpu = true

[[inputs.mqtt_consumer]]

servers = [“tcp://192.168.5.59:1883”]

topics = [“solar_assistant/#”]

username = “Marobel”

password = “aralgigi01”

client_id = “telegraf-eg4”

topic_tag = “topic”

data_format = “value”

data_type = “auto_float”

qos = 1

[[outputs.influxdb_v2]]

urls= [“http://192.168.5.xxx:8086”]

token= "influxdb_token>

organization = “Bxoxoxo”

bucket= “solar_data”

You are writing a field as two different types. The first type written wins, and later points with a different type for that field are rejected with the error you see.

In other words, if you create a field like show_size and write 10.5 to it, later writing the string BigHippo to that field, the second write will fail with a field type conflict.

1 Like

Then it’s probably coming from my telegraf.cnfg file where the data accumulation starts. I don’t have much experience in writing telegraf. Here’s what I’ve got so far :slight_smile:

[agent]
interval = “10s”
debug = true

[[inputs.cpu]]
percpu = true
totalcpu = true

[[inputs.mqtt_consumer]]
servers = [“tcp://192.168.Z.XX:1883”]
topics = [“solar_assistant/#”]

username = “MarXXX”
password = “password”
client_id = “telegraf-eg4”
topic_tag = “topic”
data_format = “value”
data_type = “auto_float”
qos = 1

[[outputs.influxdb_v2]]
urls = [“http://192.168.x.xxx:8086”]
token = "token>
organization = “BellStar”
bucket = “solar_data”

I’m getting a parse error in the telegraf log but I don’t think is what’s giving me the issue in the time reset. I’ve changed some of the G-bloc to correct for UTC but I’m still getting a reset at 4PM PST.

I’m seeing this error message in my telegraf logs as I mentioned. It’s not causing an issue in getting the data I want though. It has something to do with the inverter changing state from Batt/Solar to just Batt. when the comes up/goes down I’m not interested in this info but would like some advice on cleaning up the error.

2025-12-13T17:13:08Z E! [agent] Error writing to outputs.influxdb_v2: failed to write metrics to solar_data (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: field type conflict: input field “value” on measurement “mqtt_consumer” is type string, already exists as type float dropped=4

Maybe that’s your issue.
The docs (telegraf/plugins/parsers/value at master · influxdata/telegraf · GitHub) say:

converts the received data to a floating-point value if possible and will return the data as string otherwise. This is helpful for mixed-type data. Integer data will be treated as floating-point values.

Could it be that you have one or some topics that are not floats?

Like “unknown”, “unavailable”? Like Homeassistant sensors do at times?

Thanks for your suggestion. Reading the GitHub post suggests that “auto_float” and ”auto_integer” should help in the “data_type” line. I just tried the “auto_integer” and then the “string” and each of those interrupted the telegraf.conf file. No data flows after that until I replace with the original “auto_float”.

I’m open for anything else you might suggest.