{"record":{"id":"fb7fe67e552feeb2","repo":"mastra-ai/mastra","slug":"neon-provisioning-failed-row-error-row-er","errorCode":null,"errorMessage":"Neon provisioning failed${row.error ? ` — ${row.error}` : ''}","messagePattern":"Neon provisioning failed(.+?)` : ''\\}","errorType":"exception","errorClass":"PlatformApiError","httpStatus":500,"severity":"error","filePath":"mastracode/mastra-factory/src/platform.ts","lineNumber":257,"sourceCode":"    signal?.throwIfAborted();\n    // Bound each poll by whatever remains of the overall budget so a stuck\n    // fetch can't exceed `timeoutMs`.\n    const remaining = deadline - Date.now();\n    if (remaining <= 0) throw timeoutError();\n    const perRequestSignal = composeSignals(signal, AbortSignal.timeout(remaining));\n    let row: AttachedDatabase;\n    try {\n      row = await getDatabaseStatus({ token, orgId, projectId, databaseId, signal: perRequestSignal });\n    } catch (err) {\n      // Reshape the per-request timeout as the same 504 the deadline branch\n      // raises; other errors (network, 5xx) bubble up unchanged.\n      if (err instanceof DOMException && err.name === 'TimeoutError') throw timeoutError();\n      throw err;\n    }\n    lastStatus = row.status;\n    if (row.status === 'ready') return row;\n    if (row.status === 'failed') {\n      throw new PlatformApiError(500, `Neon provisioning failed${row.error ? ` — ${row.error}` : ''}`);\n    }\n    if (Date.now() >= deadline) throw timeoutError();\n    await new Promise(resolve => setTimeout(resolve, intervalMs));\n  }\n}\n\n/**\n * Compose an outer AbortSignal with a per-request timeout signal. Uses\n * `AbortSignal.any` where available (Node ≥20.3); falls back to a manual\n * proxy for older runtimes.\n */\nfunction composeSignals(outer: AbortSignal | undefined, inner: AbortSignal): AbortSignal {\n  if (!outer) return inner;\n  if (typeof AbortSignal.any === 'function') {\n    return AbortSignal.any([outer, inner]);\n  }\n  const controller = new AbortController();\n  const abort = (reason: unknown) => controller.abort(reason);","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/mastra-factory/src/platform.ts#L239-L275","documentation":"waitForDatabaseReady polls getDatabaseStatus until the Neon database reaches a terminal state. If the API reports status 'failed', it throws this PlatformApiError (500), appending the server-supplied `row.error` detail when present, so the user sees why provisioning failed.","triggerScenarios":"The platform reports `row.status === 'failed'` during the status polling loop — Neon itself failed to create/attach the database; `row.error` carries the upstream reason.","commonSituations":"Unsupported or out-of-capacity region; database name violating Neon charset/length rules; quota/billing limits reached on the Neon org; transient Neon infrastructure failure during initial provisioning.","solutions":["Read the detail after the em-dash — it is the upstream Neon error and indicates the fix.","Retry create-factory: many failures (capacity, transient infra) succeed on a second run.","Pick a different regionId if the error suggests regional capacity or unsupported-region issues.","Check Neon org quotas/billing if the error indicates limits, then rerun; verify the name matches [a-zA-Z0-9_-] up to 64 chars."],"exampleFix":"// before\nawait attachNeonDatabase({ token, orgId, projectId, name: 'production db!', regionId: 'aws-us-east-1' });\n// after\nawait attachNeonDatabase({ token, orgId, projectId, name: 'production-db', regionId: 'aws-us-east-1' });","handlingStrategy":"try-catch","validationCode":"if (!/^[a-zA-Z0-9_-]{1,64}$/.test(dbName)) throw new Error('DB name must match [a-zA-Z0-9_-]{1,64}');\nif (!supportedNeonRegions.includes(regionId)) throw new Error(`Unsupported region: ${regionId}`);","typeGuard":null,"tryCatchPattern":"try {\n  const db = await waitForDatabaseReady(opts);\n} catch (err) {\n  if (err instanceof PlatformApiError && err.message.startsWith('Neon provisioning failed')) {\n    console.error('Neon reported a provisioning failure. Detail:', err.message);\n    console.error('Retry create-factory, try a different region, or check Neon org quotas/billing.');\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Validate the DB name against Neon's charset ([a-zA-Z0-9_-], max 64) before attaching.","Pick a commonly supported region to avoid capacity/unsupported-region failures.","Check Neon org quota/billing status before large provisioning runs.","Retry once on transient upstream errors; surface row.error detail to the user."],"tags":["neon","provisioning-failed","platform-api","polling"],"backgroundTag":"provisioning-failed","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}