{"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":"error","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/711f03abce4f7a65e3a84b8893be60675a8aef39/lib/vector-core/src/event/lua/metric.rs#L69-L105","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"-- before: number element in the tag array panics (unimplemented!)\nfunction process(event)\n  event.metric.tags.hosts = {\"host-a\", event.log.host_id}  -- host_id is a number\nend\n\n-- after: coerce every element to a string\nfunction process(event)\n  event.metric.tags.hosts = {\"host-a\", tostring(event.log.host_id)}\nend","handlingStrategy":"validation","validationCode":"-- Lua: validate the array is all-strings before assigning it as a tag value\nlocal function to_tag_array(values)\n  local out = {}\n  for _, v in ipairs(values) do\n    out[#out + 1] = tostring(v)\n  end\n  return out\nend\n\nevent.metric.tags.hosts = to_tag_array(candidates)","typeGuard":"-- returns true only when t is a plain array of Lua strings\nlocal function is_string_array(t)\n  if type(t) ~= \"table\" then return false end\n  for _, v in ipairs(t) do\n    if type(v) ~= \"string\" then return false end\n  end\n  return true\nend","tryCatchPattern":null,"preventionTips":["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."],"tags":["lua","metrics","tags","transform","panic","rust"],"backgroundTag":"lua-type-conversion","analyzedSha":"711f03abce4f7a65e3a84b8893be60675a8aef39","analyzedAt":"2026-08-16T23:17:25.807Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}