denoland/deno · error

Invalid registry configuration. Registry with schema "{}" is

Error message

Invalid registry configuration. Registry with schema "{}" is missing variable declaration for key "{}".

What it means

Part of the LSP registry-config validator (cli/lsp/registries.rs:333): after converting a registry's "schema" string into a path-to-regex template, every named path parameter found in the schema (e.g. :package in "/x/:package@:version") must have a matching entry in that registry's "variables" array. If a key appears in the schema but not in variables, the config is rejected with this message naming the schema and the orphan key.

Source

Thrown at cli/lsp/registries.rs:333

          .filter_map(|k| {
            if let StringOrNumber::String(s) = &k.name {
              Some(s.clone())
            } else {
              None
            }
          })
          .collect()
      })
      .unwrap_or_default();

    for key_name in &key_names {
      if !registry
        .variables
        .iter()
        .map(|var| var.key.to_owned())
        .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,

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Add a variable declaration for every schema key: { "key": "package", "url": "https://example.com/packages/${package}" }
  2. Or remove the unused path parameter from the schema string so both sides stay in sync
  3. Re-fetch/republish the origin's config.json after fixing, then restart the LSP so the cache is refreshed

Example fix

// before
{ "schema": "/x/:package@:version", "variables": [ { "key": "version", "url": "..." } ] }

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

Strategy: validation

Validate before calling

function validateRegistry(r) {
  const schemaKeys = [...r.schema.matchAll(/:([A-Za-z0-9_]+)|\{([A-Za-z0-9_]+)\}/g)].map(m => m[1] ?? m[2]);
  const varKeys = r.variables.map(v => v.key);
  for (const k of schemaKeys) if (!varKeys.includes(k)) throw new Error(`schema key '${k}' has no variable`);
  return true;
}

Prevention

When it happens

Trigger: Schema "/x/:package/:path(*)" where "variables" only declares "version" and "path" but omits "package"; renaming a schema placeholder without updating the variables list.

Common situations: Hand-editing a registry config.json and adding a new path segment; template refactors that rename one parameter (mod -> module) while the variables array keeps the old key.

Related errors


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