nikivdev/code · error

registry manifest upload failed ({})

Error message

registry manifest upload failed ({})

What it means

After uploading binaries, publish uploads the package manifest JSON. If the registry returns a non-success status for the manifest upload (optionally with ?latest=1), publish bails with 'registry manifest upload failed (<status>)'. The binaries may already be uploaded at this point, leaving a partially published package.

Source

Thrown at src/registry.rs:208

        if !response.status().is_success() {
            bail!("registry upload failed for {} ({})", bin, response.status());
        }
    }

    let manifest_url = format!(
        "{}/packages/{}/{}/manifest.json",
        registry_url, package, version
    );
    let mut request = client
        .put(manifest_url)
        .header("Authorization", format!("Bearer {}", token))
        .body(serde_json::to_string_pretty(&manifest)?);
    if latest {
        request = request.query(&[("latest", "1")]);
    }
    let response = request.send().context("failed to upload manifest")?;
    if !response.status().is_success() {
        bail!("registry manifest upload failed ({})", response.status());
    }

    println!("Published {} {} to {}", package, version, registry_url);
    Ok(())
}

pub fn install(opts: InstallOpts) -> Result<()> {
    let name = opts.name.as_deref().unwrap_or("").trim().to_string();
    if name.is_empty() {
        bail!("package name is required for registry install");
    }
    let global_registry = load_global_registry_config();
    let registry_url = resolve_registry_url(opts.registry.as_deref(), global_registry.as_ref())?;
    let client = Client::builder().timeout(Duration::from_secs(60)).build()?;
    let version = opts.version.clone();
    let manifest = fetch_manifest(&client, &registry_url, &name, version.as_deref())?;
    let target = detect_target_triple()?;
    let target_entry = manifest

View on GitHub (pinned to a747e741ae)

Solutions

  1. Inspect the returned status and registry-side validation errors for the manifest.
  2. Re-authenticate — the token may permit binary but not manifest writes.
  3. Bump the version if the manifest conflicts with an existing publication.
  4. Re-run publish: binaries are keyed by content hash, so re-upload is safe.

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight manifest validation: serializable and version not conflicting
let body = serde_json::to_string_pretty(&manifest)?;
assert!(!body.is_empty());
// check existing manifest
let existing = client.get(format!("{url}/packages/{pkg}/{ver}/manifest.json")).send()?.status();
if existing.is_success() { return Err("version exists; bump the version".into()); }

Try / catch

match publish(opts) {
    Err(e) if e.to_string().contains("registry manifest upload failed") => {
        eprintln!("Binaries uploaded but manifest rejected — inspect registry validation rules, then re-run publish (idempotent for binaries).");
        std::process::exit(1);
    }
    other => other,
}

Prevention

When it happens

Trigger: POSTing the serialized manifest to `<registry_url>/packages/<package>/<version>/manifest.json` and getting a non-2xx response — auth failure, schema rejection, or version conflict.

Common situations: Token lacks manifest write permission even though binary upload succeeded; manifest JSON rejected by server validation; version already published with a different manifest.

Related errors


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