zed-industries/zed · error · anyhow::Error

Enter a valid GitHub URL

Error message

Enter a valid GitHub URL

What it means

Validation in github_raw_url(): the user-supplied string could not be parsed as a URL (or yielded no host), so it cannot be resolved to a GitHub raw content URL. Used to validate skill-import URLs before any network request.

Source

Thrown at crates/settings_ui/src/pages/skill_creator.rs:1077

        message.push_str(&response_text);
    }

    anyhow!(message)
}

pub(crate) fn is_supported_skill_url(input: &str) -> bool {
    github_raw_url(input).is_ok()
}

fn github_raw_url(input: &str) -> Result<String> {
    let url = Url::parse(input.trim()).context("Enter a valid GitHub URL")?;
    if url.scheme() != "https" {
        anyhow::bail!("GitHub skill URLs must use https://");
    }

    let host = url
        .host_str()
        .ok_or_else(|| anyhow!("Enter a valid GitHub URL"))?;
    let path_segments = url
        .path_segments()
        .ok_or_else(|| anyhow!("Enter a valid GitHub URL"))?
        .collect::<Vec<_>>();

    match host {
        "github.com" => github_blob_raw_url(&path_segments),
        "raw.githubusercontent.com" => {
            ensure_markdown_path(&path_segments)?;
            Ok(url.into())
        }
        _ => anyhow::bail!("Paste a GitHub .md URL"),
    }
}

fn github_blob_raw_url(path_segments: &[&str]) -> Result<String> {
    let [owner, repo, kind, reference, file_path @ ..] = path_segments else {
        anyhow::bail!("Paste a GitHub blob URL that points to a .md file");

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Enter a well-formed GitHub https:// URL
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/settings_ui/src/pages/skill_creator.rs:1077 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/cae65458f8138daf. Report an issue: GitHub.