jdx/mise · error
trimSuffix requires exactly 2 arguments
Error message
trimSuffix requires exactly 2 arguments
What it means
Arity guard for the `trimSuffix` template filter in the aqua-registry template registry. The filter strips a given suffix (first argument) from a string (second argument). It fires when a template passes any argument count other than two — e.g. omitting the suffix argument or chaining the filter over a collection — preventing an out-of-bounds index on the args slice. The same two-argument contract applies to the adjacent `trimPrefix` filter.
Solutions
- Call trimSuffix with two arguments: suffix first, then the text, e.g. `(trimSuffix ".gz" .File)`
- For leading prefixes use trimPrefix instead
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/aqua-registry/src/template.rs:378 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/ae2245f85564e3a1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/aqua-registry/src/template.rs:378
Ok(Box::new(StringValue(
args[0].as_string().trim_start_matches('v').to_string(),
)) as Box<dyn Value>)
});
registry.insert("trimPrefix", |args| {
if args.len() != 2 {
bail!("trimPrefix requires exactly 2 arguments");
}
let prefix = args[0].as_string();
let text = args[1].as_string();
Ok(Box::new(StringValue(
text.strip_prefix(&prefix).unwrap_or(&text).to_string(),
)) as Box<dyn Value>)
});
registry.insert("trimSuffix", |args| {
if args.len() != 2 {
bail!("trimSuffix requires exactly 2 arguments");
}
let suffix = args[0].as_string();
let text = args[1].as_string();
Ok(Box::new(StringValue(
text.strip_suffix(&suffix).unwrap_or(&text).to_string(),
)) as Box<dyn Value>)
});
registry.insert("replace", |args| {
if args.len() != 3 {
bail!("replace requires exactly 3 arguments");
}
let from = args[0].as_string();
let to = args[1].as_string();
let text = args[2].as_string();
Ok(Box::new(StringValue(text.replace(&from, &to))) as Box<dyn Value>)
});
View on GitHub (pinned to 533346cc37)