vectordotdev/vector · critical
not implemented
Error message
not implemented
What it means
When Lua code builds a metric tag value set (a tag that can hold multiple values), the mlua `FromLua` impl for `TagValueSet` iterates the Lua table's sequence values and panics via `unimplemented!()` if any element fails to convert into a String. Only strings (and nil for the bare tag) are handled; numbers, booleans, or nested tables in the tag table hit the panic. This fires inside the Lua transform's `metric.*` API, e.g. `event.metric.tag.set_x({ ... })`.
Solutions
- Convert every element to a string in the Lua script before passing the table: `event.metric.tag.set_tags({ "a", tostring(n) })`.
- Keep tag tables homogeneous sequences of strings only — no numbers, booleans, nil holes, or mixed keys.
- Prefer the VRL `remap` transform for tag manipulation; its type checking rejects non-string tags at compile time of the program.
Example fix
-- before (panics on the number)
event.metric.tag.set_tags({ "env", 42 })
-- after
event.metric.tag.set_tags({ "env", tostring(42) }) Defensive patterns
Strategy: validation
Validate before calling
-- Lua: build the tag table defensively
local tags = {}
for i, v in ipairs(raw_tags) do
if type(v) == "string" then tags[#tags+1] = v end
end
event.metric.tag.set_tags(tags) Type guard
-- Lua guard: every element must be a string local ok = true for i, v in ipairs(raw_tags) do if type(v) ~= "string" then ok = false end end
Prevention
- Wrap tag values with tostring() at the boundary in Lua scripts.
- Keep tag tables as pure sequences of strings; never mix types or keys.
- Prefer VRL remap over Lua for new work — type errors surface at program compile time.
When it happens
Trigger: Calling a metric tag setter from a `lua` transform with a table containing non-string entries, e.g. `event.metric.tag.set_tags({ "a", 1, true })` — the integer/boolean fails `String` conversion and the `Err(_)` arm panics. Passing a mixed or non-sequence table also ends up here.
Common situations: Porting Lua scripts that build tag lists from numeric data without `tostring`; config authors copying examples from Graylog/Lua docs that allow heterogeneous arrays; version upgrades where the metric Lua API changed to multi-valued tags.
Related errors
- argument must be a string
- argument must be a string
- argument must be a string
- invalid timestamp
- a record with a next ID must have an event count
AI-assisted analysis of vectordotdev/vector@3708c39b12 (2026-08-20).
Data as JSON: /api/errors/2b4b5c38b1c896ca.
Report an issue: GitHub.
Appendix: source
Thrown at lib/vector-core/src/event/lua/metric.rs:87
to: String::from("StatisticKind"),
message: Some(
"Statistic kind should be either \"summary\" or \"histogram\"".to_string(),
),
}),
}
}
}
impl FromLua for TagValueSet {
fn from_lua(value: LuaValue, _: &Lua) -> LuaResult<Self> {
match value {
LuaValue::Nil => Ok(Self::Single(TagValue::Bare)),
LuaValue::Table(table) => {
let mut string_values: Vec<String> = vec![];
for value in table.sequence_values() {
match value {
Ok(value) => string_values.push(value),
Err(_) => unimplemented!(),
}
}
Ok(Self::from(string_values))
}
LuaValue::String(x) => Ok(Self::from([x.to_string_lossy().clone()])),
_ => Err(mlua::Error::FromLuaConversionError {
from: value.type_name(),
to: String::from("metric tag value"),
message: None,
}),
}
}
}
impl FromLua for MetricTags {
fn from_lua(value: LuaValue, lua: &Lua) -> LuaResult<Self> {
Ok(Self(BTreeMap::from_lua(value, lua)?))
}View on GitHub (pinned to 3708c39b12)