vectordotdev/vector · error
not implemented
Error message
not implemented
What it means
FromLua for TagValueSet converts a Lua value into a metric tag value (lib/vector-core/src/event/lua/metric.rs:78). A Lua table is accepted only as a pure array of strings: the code iterates table.sequence_values::<String>() and any element that fails String conversion hits unimplemented!() (metric.rs:87), panicking the process instead of returning a Lua error to pcall. Nil maps to a bare tag and a plain string to a single-value tag, but non-string array elements (numbers, booleans, tables) are unhandled because mlua performs no automatic coercion to String.
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 711f03abce)
Solutions
- Wrap every element with tostring() when assigning an array tag: event.metric.tags.host = {tostring(v1), tostring(v2)}.
- Assign a single string instead of an array when only one value is needed (the LuaValue::String branch is fully supported).
- Migrate the transform from the deprecated lua transform to a VRL remap transform, which returns per-event errors instead of panicking on bad tag values.
- If you control the code, replace the Err(_) => unimplemented!() arm in lib/vector-core/src/event/lua/metric.rs:87 with a proper LuaResult conversion error so bad values fail gracefully.
Example fix
-- before: number element in the tag array panics (unimplemented!)
function process(event)
event.metric.tags.hosts = {"host-a", event.log.host_id} -- host_id is a number
end
-- after: coerce every element to a string
function process(event)
event.metric.tags.hosts = {"host-a", tostring(event.log.host_id)}
end Defensive patterns
Strategy: validation
Validate before calling
-- Lua: validate the array is all-strings before assigning it as a tag value
local function to_tag_array(values)
local out = {}
for _, v in ipairs(values) do
out[#out + 1] = tostring(v)
end
return out
end
event.metric.tags.hosts = to_tag_array(candidates) Type guard
-- returns true only when t is a plain array of Lua strings
local function is_string_array(t)
if type(t) ~= "table" then return false end
for _, v in ipairs(t) do
if type(v) ~= "string" then return false end
end
return true
end Prevention
- Never assign a table as a metric tag value without coercing every element with tostring(); numbers and booleans panic the process.
- Do not rely on Lua pcall: the failure is a Rust unimplemented!() panic, not a Lua error, so pcall will not catch it.
- Prefer single-string tag assignments unless multi-value tags are required (the string and nil branches are fully implemented).
- Migrate off the deprecated lua transform to VRL remap, which reports tag-value problems as per-event errors instead of panics.
When it happens
Trigger: A lua transform that assigns a metric tag from an array containing non-string elements, e.g. event.metric.tags.host = {"a", 1} or event.metric.tags.replicas = {true}; also building tag arrays from data that arrived as JSON numbers/booleans without tostring(). The panic happens mid-transform on the first offending event and is not catchable with Lua pcall because it is a Rust panic, not a Lua error.
Common situations: Computing tag arrays from parsed JSON payloads (counts, flags) in the lua transform and assigning them directly to metric.tags; scripts written for the single-value tag API being reused in full tag mode; any lua transform on a metrics stream after a log_to_metric transform. Note the lua transform itself is deprecated in current Vector, so this code path only exists in legacy configs.
Related errors
AI-assisted analysis of vectordotdev/vector@711f03abce (2026-08-16).
Data as JSON: /api/errors/2b4b5c38b1c896ca.
Report an issue: GitHub.