denoland/deno · error
Missing parameter name at {}
Error message
Missing parameter name at {} What it means
In the same lexer (cli/lsp/path_to_regex.rs:125), after an opening '{' the parser reads [0-9A-Za-z_] characters as the parameter name. If none are consumed the name is empty and it fails with "Missing parameter name at {index}" — the schema used a parameter placeholder with no name, like "{}" or "{$}".
Source
Thrown at cli/lsp/path_to_regex.rs:125
});
index += 1;
}
Some(':') => {
let mut name = String::new();
while let Some(c) = chars.peek() {
if (*c >= '0' && *c <= '9')
|| (*c >= 'A' && *c <= 'Z')
|| (*c >= 'a' && *c <= 'z')
|| *c == '_'
{
let ch = chars.next().unwrap();
name.push(ch);
} else {
break;
}
}
if name.is_empty() {
return Err(anyhow!("Missing parameter name at {}", index));
}
let name_len = name.len();
tokens.push(LexToken {
token_type: TokenType::Name,
index,
value: name,
});
index += 1 + name_len;
}
Some('(') => {
let mut count = 1;
let mut pattern = String::new();
if chars.peek() == Some(&'?') {
return Err(anyhow!(
"Pattern cannot start with \"?\" at {}.",
index + 1
));View on GitHub (pinned to 89f33cbef2)
Solutions
- Name the parameter: "/x/{package}/mod.ts"
- If the braces are literal, escape them or remove them from the schema
- Ensure any templating that fills {name} placeholders never emits an empty name
Example fix
// before
{ "schema": "/x/{}/mod.ts" }
// after
{ "schema": "/x/{package}/mod.ts" } Defensive patterns
Strategy: validation
Validate before calling
function hasEmptyPlaceholder(s: string): boolean {
return /\{[^A-Za-z0-9_}\s]/.test(s) || /\{\}/.test(s);
} Prevention
- Always name placeholders: {package}, {version}
- Escape literal braces in schemas
- Validate rendered templates so empty substitutions fail loudly at build time
When it happens
Trigger: A schema containing an empty placeholder: "/x/{}/mod.ts"; a '{' immediately followed by a non-identifier character like '-' or '.'; unbalanced braces from a broken template render.
Common situations: Template engines substituting an empty variable into {var}; copy-paste of path-to-regexp v6 syntax into a config that expects named groups; typos like {package } with a space (space is not an identifier char, so name stays empty).
Related errors
- Unexpected end of string at {}.
- Unexpected termination of string.
- Pattern cannot start with "?" at {}.
- Capturing groups are not allowed at {}.
- Unbalanced pattern at {}.
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/93417657e010ea8e.
Report an issue: GitHub.