{"record":{"id":"a99963bb650e3485","repo":"denoland/deno","slug":"invalid-registry-configuration-expected-version-1","errorCode":null,"errorMessage":"Invalid registry configuration. Expected version 1 or 2 got {}.","messagePattern":"Invalid registry configuration\\. Expected version 1 or 2 got (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/registries.rs","lineNumber":304,"sourceCode":"  url: &str,\n  variable: &Key,\n  maybe_value: Option<&str>,\n) -> String {\n  let url_str = url.to_string();\n  let value = maybe_value.unwrap_or(\"\");\n  if let StringOrNumber::String(name) = &variable.name {\n    url_str\n      .replace(&format!(\"${{{name}}}\"), value)\n      .replace(&format! {\"${{{{{name}}}}}\"}, value)\n  } else {\n    url_str\n  }\n}\n\n/// Validate a registry configuration JSON structure.\nfn validate_config(config: &RegistryConfigurationJson) -> Result<(), AnyError> {\n  if config.version < 1 || config.version > 2 {\n    return Err(anyhow!(\n      \"Invalid registry configuration. Expected version 1 or 2 got {}.\",\n      config.version\n    ));\n  }\n  for registry in &config.registries {\n    let (_, keys) = string_to_regex(&registry.schema, None)?;\n    let key_names: Vec<String> = keys\n      .map(|keys| {\n        keys\n          .iter()\n          .filter_map(|k| {\n            if let StringOrNumber::String(s) = &k.name {\n              Some(s.clone())\n            } else {\n              None\n            }\n          })\n          .collect()","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/lsp/registries.rs#L286-L322","documentation":"The Deno LSP downloads a per-origin registry configuration (config.json) describing completion schemas for custom module registries; validate_config in cli/lsp/registries.rs:304 rejects any document whose top-level \"version\" integer is outside 1..=2. Version defines the semantics of variable references (v1 forbids self-references, v2 allows them), so an unknown major is unsafe to interpret.","triggerScenarios":"A registry serving { \"version\": 3, \"registries\": [...] } or version 0; the origin's config.json is fetched when the editor first requests completions for that host (enabled via import-suggestion hosts).","commonSituations":"Registry authors drafting a v3 schema; an origin serving a stub/placeholder config; integers parsed from a YAML-ish hand-edit that dropped the version field to 0 via default.","solutions":["Set \"version\": 2 (current) in the origin's config.json","If you maintain a v1-era config, keep \"version\": 1 and its stricter self-reference rules","If you don't control the origin, disable that host in the editor's import-completion hosts so the LSP stops fetching it"],"exampleFix":"// before (https://example.com/config.json)\n{ \"version\": 3, \"registries\": [ ... ] }\n\n// after\n{ \"version\": 2, \"registries\": [ ... ] }","handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(configJsonText);\nif (!Number.isInteger(cfg.version) || cfg.version < 1 || cfg.version > 2) {\n  throw new Error(`unsupported registry config version: ${cfg.version}`);\n}","typeGuard":"function isKnownRegistryConfig(v: unknown): v is { version: 1 | 2; registries: unknown[] } {\n  const o = v as Record<string, unknown>;\n  return (o.version === 1 || o.version === 2) && Array.isArray(o.registries);\n}","tryCatchPattern":null,"preventionTips":["Serve config.json from a template tested against the version field enum","Disable unused completion hosts in the editor so foreign/broken configs are never fetched","Track Deno release notes when bumping registry config majors"],"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"}