jdx/mise · error
replace requires exactly 3 arguments
Error message
replace requires exactly 3 arguments
What it means
Arity check in the template function registry: `replace` takes exactly three arguments (old, new, text); the aqua template called it with a different count, so the closure bails before performing the substitution.
Solutions
- Call replace with three arguments, e.g. `(replace "_" "-" .Name)`
- For simple prefix/suffix removal prefer trimPrefix/trimSuffix
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/aqua-registry/src/template.rs:389 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/bd7694f9a5470c12.
Report an issue: GitHub.
Appendix: source
Thrown at crates/aqua-registry/src/template.rs:389
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>)
});
registry
});
/// Evaluator walks the AST and produces results
struct Evaluator<'a> {
ctx: &'a Context,
}
impl<'a> Evaluator<'a> {
fn new(ctx: &'a Context) -> Self {
Self { ctx }View on GitHub (pinned to 533346cc37)