{"record":{"id":"0ac494959bf5be02","repo":"nikivdev/code","slug":"registry-upload-failed-for","errorCode":null,"errorMessage":"registry upload failed for {} ({})","messagePattern":"registry upload failed for (.+?) \\((.+?)\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/registry.rs","lineNumber":191,"sourceCode":"        .unwrap_or(DEFAULT_TOKEN_ENV);\n    let token = resolve_registry_token(token_env)?;\n    let client = Client::builder().timeout(Duration::from_secs(60)).build()?;\n\n    for bin in &bins {\n        let path = project_root.join(\"target\").join(\"release\").join(bin);\n        let key = format!(\"packages/{}/{}/{}/{}\", package, version, target, bin);\n        let url = format!(\"{}/{}\", registry_url, key);\n        let body = fs::read(&path)?;\n        let sha = sha256_file(&path)?;\n        let response = client\n            .put(url)\n            .header(\"Authorization\", format!(\"Bearer {}\", token))\n            .header(\"X-Sha256\", sha)\n            .body(body)\n            .send()\n            .context(\"failed to upload binary\")?;\n        if !response.status().is_success() {\n            bail!(\"registry upload failed for {} ({})\", bin, response.status());\n        }\n    }\n\n    let manifest_url = format!(\n        \"{}/packages/{}/{}/manifest.json\",\n        registry_url, package, version\n    );\n    let mut request = client\n        .put(manifest_url)\n        .header(\"Authorization\", format!(\"Bearer {}\", token))\n        .body(serde_json::to_string_pretty(&manifest)?);\n    if latest {\n        request = request.query(&[(\"latest\", \"1\")]);\n    }\n    let response = request.send().context(\"failed to upload manifest\")?;\n    if !response.status().is_success() {\n        bail!(\"registry manifest upload failed ({})\", response.status());\n    }","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/registry.rs#L173-L209","documentation":"During publish, each binary is PUT/POSTed to the registry with an Authorization bearer token and X-Sha256 header. If the registry responds with a non-2xx status, publish bails with 'registry upload failed for <bin> (<status>)'.","triggerScenarios":"Uploading binary `bin` to `<registry_url>/packages/...` and receiving a non-success HTTP status, e.g. 401 (bad/expired token), 403 (no permission), 409 (version exists), or 5xx (registry outage).","commonSituations":"Expired or wrong registry token; publishing a version that already exists; registry rejecting too-large binaries; registry maintenance/downtime.","solutions":["Check the HTTP status printed in the error and the registry server logs for the exact rejection reason.","Refresh or correct your bearer token (login again / update registry credentials).","If 409 conflict, bump the version or use an appropriate overwrite flag.","Retry later if the status is 5xx (registry-side problem)."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// Pre-flight: verify credentials and that the version is new\nlet status = client.get(format!(\"{registry}/packages/{pkg}/{ver}/manifest.json\")).send()?.status();\nif status == reqwest::StatusCode::CONFLICT {\n    return Err(\"version already published; bump version first\".into());\n}","typeGuard":null,"tryCatchPattern":"match publish(opts) {\n    Err(e) if e.to_string().contains(\"registry upload failed\") => {\n        if is_server_error(&e) {\n            retry_with_backoff(3, || publish(opts.clone()));\n        } else {\n            eprintln!(\"Upload rejected: check token/permissions/version conflict\");\n            std::process::exit(1);\n        }\n    }\n    other => other,\n}","preventionTips":["Refresh registry tokens before CI publish jobs; check expiry.","Bump versions before publishing; never republish the same version.","Monitor registry status/uptime before release windows."],"tags":["network","http","publish","registry"],"backgroundTag":"http-upload-rejected","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}