{"record":{"id":"7880deb70a72fe7f","repo":"denoland/deno","slug":"invalid-registry-configuration-url-for-vari","errorCode":null,"errorMessage":"Invalid registry configuration. Url \"{}\" (for variable \"{}\" in registry with schema \"{}\") uses variable \"{}\", which is not allowed because that would be a self reference.","messagePattern":"Invalid registry configuration\\. Url \"(.+?)\" \\(for variable \"(.+?)\" in registry with schema \"(.+?)\"\\) uses variable \"(.+?)\", which is not allowed because that would be a self reference\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/registries.rs","lineNumber":349,"sourceCode":"        .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,\n            variable.key,\n            registry.schema,\n            v\n          ));\n        }\n\n        let key_index = limited_keys.iter().position(|key| key == &v);\n\n        if key_index.is_none() && variable.key != v {\n          return Err(anyhow!(\n            \"Invalid registry configuration. Url \\\"{}\\\" (for variable \\\"{}\\\" in registry with schema \\\"{}\\\") uses variable \\\"{}\\\", which is not allowed because the schema defines \\\"{}\\\" to the right of \\\"{}\\\".\",\n            variable.url,\n            variable.key,\n            registry.schema,\n            v,\n            v,","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/lsp/registries.rs#L331-L367","documentation":"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.","triggerScenarios":"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.","commonSituations":"Porting older deno.land-era v1 registry configs that accidentally interpolate the same key; templates rendered from the key itself.","solutions":["If the circular reference is intentional, bump \"version\" to 2 in the origin's config.json","Otherwise remove the self-interpolation from the URL (use a different variable or a literal path)","If you don't control the registry, disable that completion host in editor settings"],"exampleFix":"// before\n{ \"version\": 1, \"registries\": [ { \"schema\": \"/x/:package\", \"variables\": [ { \"key\": \"package\", \"url\": \"https://example.com/p/${package}\" } ] } ] }\n\n// after\n{ \"version\": 2, \"registries\": [ { \"schema\": \"/x/:package\", \"variables\": [ { \"key\": \"package\", \"url\": \"https://example.com/p/${package}\" } ] } ] }","handlingStrategy":"validation","validationCode":"if (cfg.version === 1) {\n  for (const v of r.variables) {\n    if (new RegExp(`\\\\$\\\\{${v.key}\\\\}`).test(v.url)) throw new Error(`self reference in ${v.url}`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default new configs to version 2 to allow self-references","When forking an old v1 config, audit every ${...} in variable URLs for self-reference"],"tags":["lsp","registry","configuration","self-reference"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}