{"record":{"id":"5e7153add089e653","repo":"paperclipai/paperclip","slug":"too-many-migrator-producer-runs-to-establish-publication","errorCode":null,"errorMessage":"Too many migrator producer runs to establish publication.","messagePattern":"Too many migrator producer runs to establish publication\\.","errorType":"console","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/cloud-readiness.mjs","lineNumber":41,"sourceCode":"    if (!Array.isArray(body.workflow_runs) || !Number.isSafeInteger(body.total_count) || body.total_count < 0 ||\n        (page === 1 && (body.total_count === 0) !== (body.workflow_runs.length === 0))) throw new Error(\"Invalid migrator producer response.\");\n    if (body.total_count === 0) return false;\n    for (const run of body.workflow_runs) {\n      if (run.head_sha !== sha || run.head_branch !== \"master\" || run.path !== workflow ||\n          run.head_repository?.id !== 1170821064 || run.head_repository.full_name !== repository ||\n          ![\"push\", \"workflow_dispatch\"].includes(run.event)) throw new Error(\"Migrator producer identity mismatch.\");\n      // Publication is immutable. A later failed manual run must not hide a\n      // successful exact-source publisher; the signed bundle is checked next.\n      if (run.status === \"completed\" && run.conclusion === \"success\") return true;\n      if (run.status !== \"completed\") pending = true;\n      else failures.push(`${run.id}: ${run.conclusion}`);\n    }\n    if (page * 100 >= body.total_count) {\n      if (pending) return false;\n      throw new Error(`Migrator producers failed: ${failures.join(\", \")}.`);\n    }\n  }\n  throw new Error(\"Too many migrator producer runs to establish publication.\");\n}\n\nexport function verifyManifestProvenance(bytes, sha, { exec = execFileSync } = {}) {\n  versionFor(sha);\n  const scratch = mkdtempSync(path.join(os.tmpdir(), \"cloud-readiness-attestation-\"));\n  try {\n    const file = path.join(scratch, \"manifest.json\");\n    writeFileSync(file, bytes);\n    exec(\"gh\", [\"attestation\", \"verify\", file, \"--repo\", repository,\n      \"--source-digest\", sha, \"--source-ref\", \"refs/heads/master\",\n      \"--cert-identity\", `https://github.com/${repository}/${workflow}@refs/heads/master`,\n      \"--deny-self-hosted-runners\"], { stdio: \"inherit\", timeout: 60_000 });\n  } finally { rmSync(scratch, { recursive: true, force: true }); }\n}\n\n/** Read-only availability gate. Deployment still resolves and pins artifacts. */\nexport async function waitForCloudArtifacts(sha, {\n  fetchImpl = fetch,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/scripts/cloud-readiness.mjs#L23-L59","documentation":"migratorPublished() pages through workflow runs with per_page=100 up to 10 pages (1000 runs max). If total_count exceeds that and no success/pending/failed conclusion was reached in those pages, it throws this overflow error rather than making an unbounded trust decision.","triggerScenarios":"More than 1000 cloud-migrator-artifacts workflow runs exist for the exact head_sha on master with no successful run found in the first 10 pages.","commonSituations":"A runaway automation repeatedly dispatching the migrator workflow on the same commit (hundreds of retries), combined with no successful publication; pathological CI retry loops.","solutions":["Find the successful run via the GitHub UI/API filtered by head_sha and confirm publication; the error means the paging cap was hit, not that publication failed.","Reduce run volume: stop the retry loop dispatching the workflow, then rerun readiness.","Increase the page cap (page <= 10) in scripts/cloud-readiness.mjs if legitimate volume genuinely exceeds 1000 runs."],"exampleFix":"// before\nfor (let page = 1; page <= 10; page++) {\n// after\nfor (let page = 1; page <= 20; page++) { // raise cap if runs legitimately exceed 1000","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await waitForCloudArtifacts(sha);\n} catch (error) {\n  if (error.message === \"Too many migrator producer runs to establish publication.\") {\n    console.error(\">1000 runs for this SHA and none succeeded — stop retry loops and publish once.\");\n    process.exitCode = 1;\n  } else throw error;\n}","preventionTips":["Avoid automation that repeatedly dispatches the workflow for the same SHA without checking results","Cap retry loops at the caller level","Alert on unusually high workflow run counts per commit"],"tags":["github-api","pagination","ci-failure"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}