{"record":{"id":"cc8a2307a736524c","repo":"denoland/deno","slug":"failed-to-publish-packages","errorCode":null,"errorMessage":"Failed to publish {} packages:","messagePattern":"Failed to publish (.+?) packages:","errorType":"exception","errorClass":"AnyError","httpStatus":null,"severity":"error","filePath":"cli/tools/publish/mod.rs","lineNumber":1089,"sourceCode":"    }\n    Err(combine_publish_errors(errors))\n  }\n}\n\n/// Combines the errors collected while publishing multiple packages into a\n/// single error, preserving each error's context chain.\nfn combine_publish_errors(mut errors: Vec<AnyError>) -> AnyError {\n  if errors.len() == 1 {\n    return errors.remove(0);\n  }\n\n  let mut message = format!(\"Failed to publish {} packages:\", errors.len());\n  for err in &errors {\n    // `{:#}` renders the full anyhow context chain (e.g.\n    // \"Failed to publish @scope/name: <cause>\").\n    message.push_str(&format!(\"\\n\\n* {:#}\", err));\n  }\n  deno_core::anyhow::anyhow!(message)\n}\n\nasync fn publish_package(\n  http_client: &HttpClient,\n  package: Rc<PreparedPublishPackage>,\n  registry_api_url: &Url,\n  registry_url: &Url,\n  authorization: &str,\n  provenance: bool,\n) -> Result<(), AnyError> {\n  log::info!(\n    \"{} @{}/{}@{} ...\",\n    colors::intense_blue(\"Publishing\"),\n    package.scope,\n    package.package,\n    package.version\n  );\n","sourceCodeStart":1071,"sourceCodeEnd":1107,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/publish/mod.rs#L1071-L1107","documentation":"When `deno publish` publishes a workspace with multiple packages and more than one package fails, the individual errors are combined into a single error with this header followed by one bulleted entry per package (each rendered with its full context chain, e.g. 'Failed to publish @scope/name: <cause>'). It is purely an aggregation wrapper: the real causes are the per-package errors listed below the header.","triggerScenarios":"A workspace publish where 2+ members each failed for independent reasons — e.g. one missing a `version` field, another having slow types, a third hitting a registry auth/409 version-already-exists error.","commonSituations":"First publish of a monorepo where several members share the same scaffolding mistake (all missing version, all missing exports map); partial network failure during a multi-package upload; one package already published at that version while another has an unrelated error.","solutions":["Read each `* <error>` bullet under the header; every bullet is an independent per-package failure with its full cause chain — fix them individually.","Fix the most mechanical errors first (missing 'version', missing 'exports', slow types), then re-run `deno publish --dry-run` to re-validate all members cheaply.","If a package failed only because its version already exists on jsr.io, bump that package's version (or use --allow-dirty/--skip-verification as appropriate) instead of republishing.","Re-run `deno publish` after fixes; packages that succeeded are reported separately, so only failed ones retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const cmd = new Deno.Command('deno', { args: ['publish', '--dry-run'] });\nconst { success, stderr } = await cmd.output();\nif (!success) {\n  // dry-run surfaces the same per-package errors before any upload\n  throw new Error(new TextDecoder().decode(stderr));\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runDeno(['publish']);\n} catch (e) {\n  if (String(e.message).startsWith('Failed to publish')) {\n    // each bullet after the header is one independent package failure\n    const failures = e.message.split('\\n\\n* ').slice(1);\n    for (const f of failures) fixOrReport(f);\n  }\n}","preventionTips":["Always run `deno publish --dry-run` first in CI; it catches the same per-package errors with no side effects.","Fix shared scaffolding mistakes once across the workspace (version, exports, slow types).","Expect already-published versions to fail and bump versions before the real publish run."],"tags":["publish","jsr","workspace","aggregate-error","multi-package"],"backgroundTag":"batch-operation-failure","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}