{"record":{"id":"4378c173ea25783a","repo":"denoland/deno","slug":"invalid-registry-configuration-registry-with-sche","errorCode":null,"errorMessage":"Invalid registry configuration. Registry with schema \"{}\" is missing variable declaration for key \"{}\".","messagePattern":"Invalid registry configuration\\. Registry with schema \"(.+?)\" is missing variable declaration for key \"(.+?)\"\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/registries.rs","lineNumber":333,"sourceCode":"          .filter_map(|k| {\n            if let StringOrNumber::String(s) = &k.name {\n              Some(s.clone())\n            } else {\n              None\n            }\n          })\n          .collect()\n      })\n      .unwrap_or_default();\n\n    for key_name in &key_names {\n      if !registry\n        .variables\n        .iter()\n        .map(|var| var.key.to_owned())\n        .any(|x| x == *key_name)\n      {\n        return Err(anyhow!(\n          \"Invalid registry configuration. Registry with schema \\\"{}\\\" is missing variable declaration for key \\\"{}\\\".\",\n          registry.schema,\n          key_name\n        ));\n      }\n    }\n\n    for variable in &registry.variables {\n      let key_index = key_names.iter().position(|key| *key == variable.key);\n      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))?;\n\n      let replacement_variables = parse_replacement_variables(&variable.url);\n      let limited_keys = key_names.get(0..key_index).unwrap();\n      for v in replacement_variables {\n        if variable.key == v && config.version == 1 {\n          return Err(anyhow!(\n            \"Invalid registry configuration. Url \\\"{}\\\" (for variable \\\"{}\\\" in registry with schema \\\"{}\\\") uses variable \\\"{}\\\", which is not allowed because that would be a self reference.\",\n            variable.url,","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/lsp/registries.rs#L315-L351","documentation":"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.","triggerScenarios":"Schema \"/x/:package/:path(*)\" where \"variables\" only declares \"version\" and \"path\" but omits \"package\"; renaming a schema placeholder without updating the variables list.","commonSituations":"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.","solutions":["Add a variable declaration for every schema key: { \"key\": \"package\", \"url\": \"https://example.com/packages/${package}\" }","Or remove the unused path parameter from the schema string so both sides stay in sync","Re-fetch/republish the origin's config.json after fixing, then restart the LSP so the cache is refreshed"],"exampleFix":"// before\n{ \"schema\": \"/x/:package@:version\", \"variables\": [ { \"key\": \"version\", \"url\": \"...\" } ] }\n\n// after\n{ \"schema\": \"/x/:package@:version\", \"variables\": [ { \"key\": \"package\", \"url\": \"https://example.com/packages/${package}\" }, { \"key\": \"version\", \"url\": \"...\" } ] }","handlingStrategy":"validation","validationCode":"function validateRegistry(r) {\n  const schemaKeys = [...r.schema.matchAll(/:([A-Za-z0-9_]+)|\\{([A-Za-z0-9_]+)\\}/g)].map(m => m[1] ?? m[2]);\n  const varKeys = r.variables.map(v => v.key);\n  for (const k of schemaKeys) if (!varKeys.includes(k)) throw new Error(`schema key '${k}' has no variable`);\n  return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive variables from the schema mechanically instead of writing both by hand","Add a CI lint that diffs schema placeholders against variable keys for every registry entry","Rename keys in both places in the same commit"],"tags":["lsp","registry","configuration","validation"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}