Troubleshooting
Why a renamed InfluxDB field writes after a field type conflict
Short answer
InfluxDB binds each field key to one data type per shard, and delete removes points, not that type record, so an emptied field still refuses a float. A renamed field key starts with a new type, which is why your renamed fields write. Keep the new key and convert the old strings with toFloat() in Flux instead of deleting again.

On this page
Yes — and your renamed field already proved it. InfluxDB binds a field key to one data type the moment the first point for it lands in a shard, and a delete removes points, not that type record. Emptied or not, PH1_SOIL still answers string when a float arrives, while PH_SOIL and PH2_SOIL write cleanly because a new field key starts with a new type. Stop deleting, keep the rename, and convert the old strings when you read them. Below: where the type lives, what the Telegraf log already told you, and the Flux query that stitches old strings and new floats into one numeric series.
Read the Telegraf log first #
The output log names the fault before any dashboard does. In this failure it carried a field-type-conflict error for the offending point — the same class of message Telegraf's tracker records for series type mismatches, for example the Redis input case where a conflicting field name produced type errors in the log. Capture the complete line, its timestamp and the point it names, then match it to a sensor message so you are reading the current configuration, not an old rejection. Three outcomes:
- A field type conflict or partial-write error naming the field: the payload parsed, the point reached InfluxDB, and the database refused the type. Leave the decoder alone — this is the storage-schema branch.
- A parse error — quoted JSON, a missing key, a wrong format: the value never became a float. Fix parsing first; why Telegraf writes MQTT float values into the string measurement covers that branch, and a walkthrough of parsing MQTT JSON with Telegraf and InfluxDB shows the parser setup.
- No write attempt at all for that message: receipt or routing failed before the database. When the MQTT consumer connects but writes no data to InfluxDB is that branch.
Work backward from that line. A Grafana panel cannot repair an ingestion rejection, and neither can another pass over the payload decoder.
Why delete leaves the type behind #
When the first point for a field key reaches a shard, the shard's field index records the measurement, the key and its type, and every later write into that shard is validated against that entry. A delete marks point data for removal; it does not rewrite the index. So an empty query after your delete proved only that no points matched the filters and time range — nothing about the type entry. That is exactly what you observed: every value under PH1_SOIL gone, floats under that name still refused, floats under a new name accepted.
The check exists to protect the shard. A shard that ends up holding two types for one field key can refuse to open at startup — the InfluxDB tracker holds that failure report — so the engine rejects the write rather than mix types. Deleting harder changes nothing about that trade.
What to record before you change anything #
- The full conflict line from the Telegraf output. It names the bucket, measurement, field key and expected type, and it is your evidence for every step below.
- The InfluxDB version. Delete support moved across releases — early 2.0 builds answered delete attempts with
Not implemented, and the 1.x engine stores the index differently again. - Every producer writing that measurement, not only the sensor you changed.
- The exact identity of the refused point: bucket, measurement, field key, tag set.
- The moment you switched the decoder — the boundary between string history and float history.
Write the float under a new field key #
- Pick the new key and use it everywhere.
PH_SOILandPH2_SOILboth took floats in this case; choose one name, one mapping. - Make the value leave the ingestion boundary as a number, not a numeric-looking string. If the mapping itself needs rebuilding, turn an MQTT topic into InfluxDB fields with Telegraf covers that step.
- Publish a known reading through the normal MQTT path.
- Read the Telegraf output for that attempt: no type-conflict line for the new key.
- Query the new key and confirm the value, timestamp, tags and that the stored type is numeric.
- Revisit the other producers on your list. One writer still sending strings re-creates the same conflict on the new name.
Changing only the tag set is not a substitute: the type entry follows the field key within the shard, so a new series identity does not buy a new type.
Convert the old strings with Flux #
Future values and historical reads are two separate jobs. The rename fixed the future; the past still sits as strings under PH1_SOIL and can stay there, because Flux converts numeric strings on read and nothing in storage is rewritten. toFloat() is the documented conversion, and it fails on any string that is not a plain number, so prefilter with a regular expression first. With an example bucket sensors and measurement soil, two example variables, old and new, each hold a table stream:
old = from(bucket: "sensors")
|> range(start: -30d)
|> filter(fn: (r) => r._measurement == "soil" and r._field == "PH1_SOIL")
|> filter(fn: (r) => r._value =~ /^[0-9]+(\.[0-9]+)?$/)
|> toFloat()
|> set(key: "_field", value: "PH_SOIL")
new = from(bucket: "sensors")
|> range(start: -30d)
|> filter(fn: (r) => r._measurement == "soil" and r._field == "PH_SOIL")
union(tables: [old, new])
|> sort(columns: ["_time"])
The expression keeps only plain decimals; widen it if your readings can be negative or carry an exponent. Choose a float conversion, not an integer one: an integer conversion drops the fraction, which for a pH-style reading is the whole point. Before converting a long range, scan the history for units, empty values or other non-numeric text that the filter would silently drop.
A sensor at one reading per minute produces 60 values per hour and 1,440 per day, so a 30-day window holds 43,200 strings — converted on every query, stored untouched. For a two-point proof, take the last string reading, 6.5, and the first float, 6.4: after conversion the mean is (6.5 + 6.4) / 2 = 6.45.
union(tables: [old, new])
|> mean()
mean() refuses strings, so the aggregate is your test. It returns 6.45 only when every row is numeric, and it fails with a type error the moment a non-numeric string survives the filter — the failure you want to see, not a silent gap on a panel.
The routes that do not work #
- Deleting again: it removed the points the first time and left the type entry standing. A second pass changes nothing.
- Dropping the measurement or the series to remove more: it deletes more data and still does not rewrite the type record on the 1.x engine.
- Hand-editing the shard's internal index files: no supported procedure resets a field type, and a damaged index can leave the shard unopenable at startup. Do not go there.
- Recreating the bucket to reuse one name: it works, but it moves every measurement in the bucket, so it is a planned migration with an export and a backfill — not a fix for one field key.
Update the dashboards and the other readers #
- Grafana panels keyed to
PH1_SOILstop receiving points after the switch. They are not broken; they point at a retired field. Repoint them to the new key, or use the union query where the history must read as one continuous line. - Transformations, calculations and alert thresholds that name the old key need the same edit.
- Every other consumer of the measurement — reports, scripts, flows — reads the new key or the converted query.
The decision #
- The log names a field type conflict and the same value writes under a new key: a shard-scoped type conflict. Keep the rename and convert the history with Flux. Done today, no data lost.
- The log names a parse error instead: the value never was a float. Fix the parsing boundary before touching the database.
- The exact old name is a hard application requirement: schedule the bucket recreation as a migration — export, recreate, backfill floats — never as an improvised fix on a live bucket.
Questions asked
Is there a command that resets a field type on the 1.x engine?
No supported one. The type lives in the shard's field index file fields.idxl, and an open issue for version 1.12 reports that DROP MEASUREMENT and DELETE are not written to that file; after an unclean stop such a shard can even fail to open with a field type conflict. Treat the type as fixed for the life of the shard and use a new field key.
Can I delete only the string values and keep the rest of the measurement?
Not by field. The delete interface filters on time range and tag predicates, and a long-standing issue records that field predicates are rejected during deletion, so you cannot target rows by field value or type. You can delete a time range for the whole measurement or filter by tag, which also removes good data around the strings.
Does the conflict clear on its own when retention rotates the shards?
Yes, once retention retires the shard that holds the strings, a newer shard accepts the float under the old name. With a short retention that can happen within days. With an infinite retention it never happens, and waiting costs you numeric history in the meantime, so rename instead of waiting.
Are the readings refused during the conflict lost?
Mostly. Telegraf retries a refused write only while the point sits in its in-memory metric buffer; once the buffer flushes or overflows, that reading is gone, and every float was refused from the moment you switched the decoder. The gap stays a gap unless you backfill from whatever holds the raw readings.


