nikivdev/code · error

registry returned {}

Error message

registry returned {}

What it means

fetch_registry_versions GETs `<registry_url>/packages/<package>/versions.json` to list existing versions (used by calver_version to dedupe same-day releases). A 404 is treated as an empty list (new package); any other non-success status bails with 'registry returned <status>'.

Source

Thrown at src/registry.rs:428

                }
            }
        }
        if let Some(value) = max_suffix {
            return format!("{}-{}", base, value + 1);
        }
    }
    base
}

fn fetch_registry_versions(registry_url: &str, package: &str) -> Result<Vec<String>> {
    let client = Client::builder().timeout(Duration::from_secs(10)).build()?;
    let url = format!("{}/packages/{}/versions.json", registry_url, package);
    let resp = client.get(url).send()?;
    if resp.status().as_u16() == 404 {
        return Ok(Vec::new());
    }
    if !resp.status().is_success() {
        bail!("registry returned {}", resp.status());
    }
    #[derive(Deserialize)]
    struct VersionsResponse {
        versions: Vec<String>,
    }
    let parsed: VersionsResponse = resp.json()?;
    Ok(parsed.versions)
}

fn fetch_manifest(
    client: &Client,
    registry_url: &str,
    name: &str,
    version: Option<&str>,
) -> Result<RegistryManifest> {
    let url = match version {
        Some(version) => format!(
            "{}/packages/{}/{}/manifest.json",

View on GitHub (pinned to a747e741ae)

Solutions

  1. Check the status code: 401/403 means you need credentials for listing versions of that package.
  2. Verify registry_url is correct and the registry is healthy (5xx/502/503 → retry later).
  3. If behind a proxy, ensure it forwards requests to the registry rather than serving error pages.

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: check registry reachability before publish
let health = client.get(format!("{}/health", registry_url)).send()?.status();
if !health.is_success() {
    return Err(format!("registry unhealthy ({}) — aborting calver publish", health));
}

Try / catch

match publish(opts) {
    Err(e) if e.to_string().contains("registry returned") => {
        if e.to_string().contains("50") {
            retry_with_backoff(3, || publish(opts.clone()));
        } else {
            eprintln!("Registry rejected version listing (auth for private packages?) — check credentials.");
            std::process::exit(1);
        }
    }
    other => other,
}

Prevention

When it happens

Trigger: During calver-based publish, the versions.json request returns a non-success, non-404 status — e.g. 401/403 on a private package, 500 on registry failure, or a proxy returning 502/503.

Common situations: Registry requires auth for listing versions of a private package; registry outage or load balancer error page; misconfigured registry_url pointing at a non-registry host.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/746bc5ba11681602. Report an issue: GitHub.