{"record":{"id":"ded60bf4eb970f32","repo":"vercel/ai","slug":"timed-out-waiting-for-snapshot-of-template-name","errorCode":null,"errorMessage":"Timed out waiting for snapshot of template \"${name}\" to publish.","messagePattern":"Timed out waiting for snapshot of template \"(.+?)\" to publish\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/sandbox-vercel/src/vercel-sandbox.ts","lineNumber":452,"sourceCode":"  abortSignal: AbortSignal | undefined;\n}): Promise<string> {\n  const deadline = Date.now() + SNAPSHOT_POLL_TIMEOUT_MS;\n  while (Date.now() < deadline) {\n    abortSignal?.throwIfAborted();\n    const refreshed = await Sandbox.get({\n      ...lookupParams,\n      name,\n      resume: false,\n      ...(abortSignal ? { signal: abortSignal } : {}),\n    });\n    if (refreshed.currentSnapshotId) {\n      return refreshed.currentSnapshotId;\n    }\n    await new Promise<void>(resolve =>\n      setTimeout(resolve, SNAPSHOT_POLL_INTERVAL_MS),\n    );\n  }\n  throw new Error(\n    `Timed out waiting for snapshot of template \"${name}\" to publish.`,\n  );\n}\n","sourceCodeStart":434,"sourceCodeEnd":456,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/sandbox-vercel/src/vercel-sandbox.ts#L434-L456","documentation":"pollForTemplateSnapshot waits for a template's snapshot to publish after creating a session from a template. If the snapshot does not become available (currentSnapshotId stays undefined) before the polling loop exhausts its attempts, it throws this plain Error. This indicates the Vercel Sandbox platform did not finish publishing the template snapshot in time.","triggerScenarios":"Calling createSession with a template whose snapshot build is slow, queued, or failed; the loop polls every SNAPSHOT_POLL_INTERVAL_MS until the overall timeout elapses without a snapshot ID appearing.","commonSituations":"Cold/rarely-used templates that take long to build; Vercel platform delays or outages; network latency; using a custom template whose image build fails silently.","solutions":["Retry createSession — the template snapshot may publish eventually.","Check the template builds/publishes correctly in the Vercel dashboard.","Use a stable, pre-published template instead of one that must snapshot on demand.","Increase headroom: pin the template so its snapshot is already warm before your call."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  await createSession({ template });\n} catch (error) {\n  if (error.message.includes('Timed out waiting for snapshot')) {\n    // retry with backoff or fall back to a pre-published template\n  } else throw error;\n}","preventionTips":["Pre-warm/publish templates before production use.","Retry createSession with exponential backoff.","Monitor Vercel platform status during incidents.","Prefer stable, already-snapshotted templates."],"tags":["timeout","sandbox","polling","vercel"],"backgroundTag":"polling-timeout","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}