{"record":{"id":"19d5bd11d20a40d1","repo":"paperclipai/paperclip","slug":"npm-accepted-the-preview-but-it-is-not-yet-visible-pending","errorCode":null,"errorMessage":"npm accepted the preview but it is not yet visible: ${[...pending].join(\", \")}. Retry reuses published packages.","messagePattern":"npm accepted the preview but it is not yet visible: (.+?)\\. Retry reuses published packages\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/preview-artifacts.mjs","lineNumber":196,"sourceCode":"    if (await packageExists(name, sha, fetchImpl)) { console.log(`Reusing ${name}@${versionFor(sha)}`); continue; }\n    console.log(`Publishing ${name}@${versionFor(sha)} (${createHash(\"sha256\").update(bytes).digest(\"hex\").slice(0, 12)})`);\n    // No package checkout, lifecycle scripts, npmrc, or branch code runs here.\n    exec(\"npm\", [\"publish\", file, \"--tag\", \"preview\", \"--access\", \"public\", \"--ignore-scripts\", \"--provenance\", \"--registry\", \"https://registry.npmjs.org\"], { stdio: \"inherit\" });\n    pending.add(name);\n  }\n  // npm accepts a package without resolving its dependencies. Submit both\n  // packages before waiting so their registry propagation can overlap.\n  for (let attempt = 0; pending.size && attempt < 60; attempt++) {\n    const checks = await Promise.all([...pending].map(async (name) => ({ name, visible: await packageExists(name, sha, fetchImpl) })));\n    for (const { name, visible } of checks) {\n      if (visible) {\n        pending.delete(name);\n        console.log(`Visible ${name}@${versionFor(sha)}`);\n      }\n    }\n    if (pending.size) await sleep(10_000);\n  }\n  if (pending.size) throw new Error(`npm accepted the preview but it is not yet visible: ${[...pending].join(\", \")}. Retry reuses published packages.`);\n}\n\nif (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {\n  const [command, ...args] = process.argv.slice(2);\n  try {\n    if (command === \"plan\" || command === \"plan-migrator\") {\n      const [sha, requestId, migrator] = args;\n      validateRequest(sha, requestId);\n      if (process.env.GITHUB_REF !== \"refs/heads/master\") throw new Error(\"Preview workflow definitions must run from master.\");\n      const { image, packages } = await planArtifacts(sha, {\n        image: command === \"plan\", migrator: command === \"plan-migrator\" || migrator === \"true\",\n      });\n      appendFileSync(process.env.GITHUB_OUTPUT, `image=${image}\\npackages=${packages}\\n`);\n    } else if (command === \"pack\") packPreview(...args);\n    else if (command === \"publish\") await publishPreview(...args);\n    else if (command === \"publish-image\") await publishImage(...args);\n    else if (command === \"result\") {\n      const [sha, requestId] = args;","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/scripts/preview-artifacts.mjs#L178-L214","documentation":"The publish-preview script publishes npm packages for a preview SHA and then polls the registry for their visibility. If, after repeated polling (10-second sleeps), some packages still have not become visible on npm, it throws this error. It signals that the publish step succeeded from npm's perspective but the registry has not propagated the packages, so downstream 'result' checks would fail.","triggerScenarios":"Running `preview-artifacts.mjs publish` where npm returns success for the publish but a subsequent `packageExists` check keeps failing for one or more packages until the retry loop exhausts; typically caused by registry propagation delay, an npm outage, or publishing to a registry/endpoint where visibility checks hit a different index.","commonSituations":"GitHub Actions preview workflows during npm CDN lag right after publish; npm incidents degrading search/fetch endpoints; misconfigured npm registry mirrors that accept publishes but delay or never serve the new versions.","solutions":["Wait and re-run the publish/publish-image workflow — the script intentionally makes retries idempotent by reusing already-published packages.","Check npm status (status.npmjs.org) for registry incidents causing propagation lag.","Verify the npm registry configured in .npmrc matches the registry queried by the visibility check; fix mirror/registry mismatch.","Inspect the workflow log for which package names are pending and confirm the publish step actually uploaded all planned packages."],"exampleFix":"// before: failing because registry lags\nawait publishPreview(sha, requestId);\n// after: retry the workflow step with backoff; publish is idempotent\nawait sleep(60_000);\nawait publishPreview(sha, requestId); // reuses already published packages","handlingStrategy":"retry","validationCode":"for (const name of packages) {\n  if (!(await packageExists(name, sha))) console.warn(`${name} not yet visible; publish will retry`);\n}","typeGuard":"null","tryCatchPattern":"try {\n  await publishPreview(sha, requestId);\n} catch (e) {\n  if (String(e.message).includes('not yet visible')) {\n    await sleep(60_000);\n    return publishPreview(sha, requestId); // idempotent retry\n  }\n  throw e;\n}","preventionTips":["Check npm status before scheduled preview publishes.","Keep the registry in .npmrc consistent with the visibility-check registry.","Treat the script's retry loop as idempotent and simply re-run the workflow on failure.","Alert on npm propagation lag in CI rather than failing the whole pipeline immediately."],"tags":["npm","publishing","propagation-delay","ci"],"backgroundTag":"http-request-failed","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}