netdata/netdata · error · anyhow::Error
{name}() expects exactly 1 argument
Error message
{name}() expects exactly 1 argument What it means
A one-argument value function (via `one_arg`) received a different number of arguments — the parser checks `args.len() != 1` before parsing the single argument. Applies to functions like SetName/ClassifyRole targets where exactly one value expression is allowed.
Source
Thrown at src/crates/netflow-plugin/src/enrichment/classifiers/parse/value.rs:6
use super::split::*;
use super::*;
pub(super) fn one_arg(name: &str, args: &[String]) -> Result<ValueExpr> {
if args.len() != 1 {
anyhow::bail!("{name}() expects exactly 1 argument");
}
parse_value_expr(args[0].trim())
}
fn three_args(name: &str, args: &[String]) -> Result<(ValueExpr, ValueExpr, ValueExpr)> {
if args.len() != 3 {
anyhow::bail!("{name}() expects exactly 3 arguments");
}
Ok((
parse_value_expr(args[0].trim())?,
parse_value_expr(args[1].trim())?,
parse_value_expr(args[2].trim())?,
))
}
pub(super) fn one_string_arg(name: &str, args: &[String]) -> Result<ValueExpr> {
let value = one_arg(name, args)?;
if !value.is_string_expression() {View on GitHub (pinned to 4864de85e2)
Solutions
- Provide exactly one argument.
- To combine values, use one concatenated expression: `SetName(Format("{}-{}", A, B))` or `SetName(A + B)`.
Example fix
// before SetName(DstIP, SrcIP) // after SetName(DstIP + "/" + SrcIP)
Defensive patterns
Strategy: validation
Validate before calling
fn arity_ok(name: &str, args: &[String]) -> bool {
if matches!(name, "SetName" | "SetDescription" | "ClassifyRole" | "ClassifySite" | "Classify" | "ClassifyGroup") {
return args.len() == 1;
}
true
} Prevention
- One-arg functions accept exactly one value expression; use + or Format() to combine.
When it happens
Trigger: Calling a 1-arg function with zero or multiple arguments: `SetName()`, `SetName(a, b)`, `ClassifyRole()`.
Common situations: Expecting SetName to accept multiple concatenated values instead of using `+` concatenation; forgetting the argument entirely.
Related errors
- Reject() does not accept arguments
- ClassifyExternal() does not accept arguments
- ClassifyInternal() does not accept arguments
- {name}() expects exactly 3 arguments
- Format() expects at least one argument
AI-assisted analysis of netdata/netdata@4864de85e2 (2026-08-15).
Data as JSON: /api/errors/8de79734ef1af7fe.
Report an issue: GitHub.