{"record":{"id":"2b4b5c38b1c896ca","repo":"vectordotdev/vector","slug":"not-implemented-2b4b5c","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"lib/vector-core/src/event/lua/metric.rs","lineNumber":87,"sourceCode":"                to: String::from(\"StatisticKind\"),\n                message: Some(\n                    \"Statistic kind should be either \\\"summary\\\" or \\\"histogram\\\"\".to_string(),\n                ),\n            }),\n        }\n    }\n}\n\nimpl FromLua for TagValueSet {\n    fn from_lua(value: LuaValue, _: &Lua) -> LuaResult<Self> {\n        match value {\n            LuaValue::Nil => Ok(Self::Single(TagValue::Bare)),\n            LuaValue::Table(table) => {\n                let mut string_values: Vec<String> = vec![];\n                for value in table.sequence_values() {\n                    match value {\n                        Ok(value) => string_values.push(value),\n                        Err(_) => unimplemented!(),\n                    }\n                }\n                Ok(Self::from(string_values))\n            }\n            LuaValue::String(x) => Ok(Self::from([x.to_string_lossy().clone()])),\n            _ => Err(mlua::Error::FromLuaConversionError {\n                from: value.type_name(),\n                to: String::from(\"metric tag value\"),\n                message: None,\n            }),\n        }\n    }\n}\n\nimpl FromLua for MetricTags {\n    fn from_lua(value: LuaValue, lua: &Lua) -> LuaResult<Self> {\n        Ok(Self(BTreeMap::from_lua(value, lua)?))\n    }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-core/src/event/lua/metric.rs#L69-L105","documentation":"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({ ... })`.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"-- before (panics on the number)\nevent.metric.tag.set_tags({ \"env\", 42 })\n\n-- after\nevent.metric.tag.set_tags({ \"env\", tostring(42) })","handlingStrategy":"validation","validationCode":"-- Lua: build the tag table defensively\nlocal tags = {}\nfor i, v in ipairs(raw_tags) do\n  if type(v) == \"string\" then tags[#tags+1] = v end\nend\nevent.metric.tag.set_tags(tags)","typeGuard":"-- Lua guard: every element must be a string\nlocal ok = true\nfor i, v in ipairs(raw_tags) do\n  if type(v) ~= \"string\" then ok = false end\nend","tryCatchPattern":null,"preventionTips":["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."],"tags":["lua","metrics","tags","mlua","panic","vector"],"backgroundTag":"lua-type-conversion","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":"2026-08-20T07:02:18.786Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}