denoland/deno · error

Unsupported registry endpoint scheme "{scheme}". Expected "h

Error message

Unsupported registry endpoint scheme "{scheme}". Expected "http" or "https".

What it means

This error is thrown by `validate_endpoint_scheme` in cli/lsp/registries.rs when a configured registry endpoint URL uses a scheme other than `http` or `https`. The LSP registry integration only supports HTTP(S) endpoints, so URLs like `file://`, `ftp://`, or typos like `htps://` are rejected. It is invoked while parsing registry URLs (`parse_url_with_base`) and fetching endpoint documentation (`get_documentation`).

Source

Thrown at cli/lsp/registries.rs:286

/// Attempt to parse a URL along with a base, where the base will be used if the
/// URL requires one.
fn parse_url_with_base(
  url: &str,
  base: &ModuleSpecifier,
) -> Result<ModuleSpecifier, AnyError> {
  let url = match Url::parse(url) {
    Ok(url) => url,
    Err(ParseError::RelativeUrlWithoutBase) => base.join(url)?,
    Err(err) => return Err(err.into()),
  };
  validate_endpoint_scheme(&url)?;
  Ok(url)
}

fn validate_endpoint_scheme(url: &Url) -> Result<(), AnyError> {
  match url.scheme() {
    "http" | "https" => Ok(()),
    scheme => Err(anyhow!(
      "Unsupported registry endpoint scheme \"{scheme}\". Expected \"http\" or \"https\"."
    )),
  }
}

/// Replaces a variable in a templated URL string with the supplied value or
/// "blank" it out if there is no value supplied.
fn replace_variable(
  url: &str,
  variable: &Key,
  maybe_value: Option<&str>,
) -> String {
  let url_str = url.to_string();
  let value = maybe_value.unwrap_or("");
  if let StringOrNumber::String(name) = &variable.name {
    url_str
      .replace(&format!("${{{name}}}"), value)
      .replace(&format! {"${{{{{name}}}}}"}, value)

View on GitHub (pinned to f7822238ca)

Solutions

  1. Change the endpoint URL scheme to `https://` (preferred) or `http://` in your deno.json registry configuration.
  2. Fix typos in the scheme, e.g. "htps" -> "https".
  3. If using a local registry, serve it over HTTP locally (e.g. `http://localhost:8080`) instead of file://.

Example fix

// deno.json
// before
{ "registry": { "endpoints": ["file:///registry/${module}.json"] } }
// after
{ "registry": { "endpoints": ["http://localhost:8080/registry/${module}.json"] } }
Defensive patterns

Strategy: validation

Validate before calling

const url = new URL(endpoint);
if (url.protocol !== "http:" && url.protocol !== "https:") {
  throw new Error(`Registry endpoint "${endpoint}" must use http or https, got "${url.protocol.replace(":", "")}"`);
}

Type guard

function isHttpEndpoint(endpoint: string): boolean {
  try {
    const u = new URL(endpoint);
    return u.protocol === "http:" || u.protocol === "https:";
  } catch {
    return false;
  }
}

Try / catch

try {
  await registry.getDocumentation(endpointUrl);
} catch (err) {
  if (String(err.message).includes("Unsupported registry endpoint scheme")) {
    console.error(`Endpoint "${endpointUrl}" must be http(s); check for typos like 'htps://' or file:// paths.`);
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Configuring a Deno LSP registry (e.g. in deno.json `"registry"` settings) with an endpoint URL whose scheme is not http/https, such as `file:///...`, `ftp://...`, or a mistyped scheme; the error surfaces when the LSP parses the URL or fetches documentation.

Common situations: Typos in the scheme ("htps://", missing 'p'), pointing a registry at a local file path with file://, or copying a custom registry URL from internal tooling that uses a non-HTTP protocol.

Related errors


AI-assisted analysis of denoland/deno@f7822238ca (2026-08-29). Data as JSON: /api/errors/86ee863c3e1e550d. Report an issue: GitHub.