denoland/deno · error
Invalid registry configuration. Url "{}" (for variable "{}"
Error message
Invalid registry configuration. Url "{}" (for variable "{}" in registry with schema "{}") uses variable "{}", which is not allowed because the schema defines "{}" to the right of "{}". What it means
cli/lsp/registries.rs:361 enforces left-to-right dependency order: a variable's URL may only interpolate variables whose schema placeholders occur strictly to the LEFT of the variable's own placeholder (limited_keys = key_names[..key_index]). Referencing a placeholder defined later in the schema produces this "defines ... to the right of ..." error, because completion for the earlier key cannot know the later key's value yet.
Source
Thrown at cli/lsp/registries.rs:361
let key_index = key_index.ok_or_else(||anyhow!("Invalid registry configuration. Registry with schema \"{}\" is missing a path parameter in schema for variable \"{}\".", registry.schema, variable.key))?;
let replacement_variables = parse_replacement_variables(&variable.url);
let limited_keys = key_names.get(0..key_index).unwrap();
for v in replacement_variables {
if variable.key == v && config.version == 1 {
return Err(anyhow!(
"Invalid registry configuration. Url \"{}\" (for variable \"{}\" in registry with schema \"{}\") uses variable \"{}\", which is not allowed because that would be a self reference.",
variable.url,
variable.key,
registry.schema,
v
));
}
let key_index = limited_keys.iter().position(|key| key == &v);
if key_index.is_none() && variable.key != v {
return Err(anyhow!(
"Invalid registry configuration. Url \"{}\" (for variable \"{}\" in registry with schema \"{}\") uses variable \"{}\", which is not allowed because the schema defines \"{}\" to the right of \"{}\".",
variable.url,
variable.key,
registry.schema,
v,
v,
variable.key
));
}
}
}
}
Ok(())
}
#[derive(Debug, Clone, Deserialize)]
pub struct RegistryConfigurationVariable {View on GitHub (pinned to 89f33cbef2)
Solutions
- Reorder the schema so referenced placeholders come first: "/x/:package/:version"
- Or change the URL to only interpolate placeholders that already appear left of the variable
- Validate the ordering with a script before publishing the config (see defense section)
Example fix
// before
{ "schema": "/x/:version/:package", "variables": [ { "key": "version", "url": "https://example.com/p/${package}/v" } ] }
// after
{ "schema": "/x/:package/:version", "variables": [ { "key": "version", "url": "https://example.com/p/${package}/v" } ] } Defensive patterns
Strategy: validation
Validate before calling
const order = [...r.schema.matchAll(/:([A-Za-z0-9_]+)/g)].map(m => m[1]);
for (const v of r.variables) {
const own = order.indexOf(v.key);
for (const ref of v.url.matchAll(/\$\{([A-Za-z0-9_]+)\}/g)) {
if (order.indexOf(ref[1]) > own) throw new Error(`${v.key} references ${ref[1]} defined to its right`);
}
} Prevention
- Design schemas so broad, early segments (owner, package) come before narrow ones (version, path)
- Only interpolate variables that appear to the left of the referencing key
When it happens
Trigger: Schema "/x/:version/:package" with { "key": "version", "url": "https://example.com/v/${package}" } — version's URL references package, which sits to its right in the schema.
Common situations: Registry schemas reordered for URL aesthetics after the variables were written; multi-segment paths where authors assume any variable can be interpolated anywhere.
Related errors
- Invalid registry configuration. Expected version 1 or 2 got
- Invalid registry configuration. Registry with schema "{}" is
- Invalid registry configuration. Registry with schema "{}" is
- Invalid registry configuration. Url "{}" (for variable "{}"
- Scope '{}' was not a directory path.
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/d291dbc966b5d7c5.
Report an issue: GitHub.