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 that would be a self reference.

What it means

cli/lsp/registries.rs:349 enforces a version-1-only rule: in v1 configs, a variable's completion URL may not reference the variable it is fetching ("${package}" inside the URL for key "package"), because that is circular. Version 2 lifted the restriction, so the same config validates fine after bumping version.

Source

Thrown at cli/lsp/registries.rs:349

        .any(|x| x == *key_name)
      {
        return Err(anyhow!(
          "Invalid registry configuration. Registry with schema \"{}\" is missing variable declaration for key \"{}\".",
          registry.schema,
          key_name
        ));
      }
    }

    for variable in &registry.variables {
      let key_index = key_names.iter().position(|key| *key == variable.key);
      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,

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. If the circular reference is intentional, bump "version" to 2 in the origin's config.json
  2. Otherwise remove the self-interpolation from the URL (use a different variable or a literal path)
  3. If you don't control the registry, disable that completion host in editor settings

Example fix

// before
{ "version": 1, "registries": [ { "schema": "/x/:package", "variables": [ { "key": "package", "url": "https://example.com/p/${package}" } ] } ] }

// after
{ "version": 2, "registries": [ { "schema": "/x/:package", "variables": [ { "key": "package", "url": "https://example.com/p/${package}" } ] } ] }
Defensive patterns

Strategy: validation

Validate before calling

if (cfg.version === 1) {
  for (const v of r.variables) {
    if (new RegExp(`\\$\\{${v.key}\\}`).test(v.url)) throw new Error(`self reference in ${v.url}`);
  }
}

Prevention

When it happens

Trigger: A v1 config declaring { "key": "package", "url": "https://example.com/p/${package}" }; enabling the host in the editor triggers check_origin, which fetches and validates the config.

Common situations: Porting older deno.land-era v1 registry configs that accidentally interpolate the same key; templates rendered from the key itself.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/7880deb70a72fe7f. Report an issue: GitHub.