{"record":{"id":"71ca87bb0c7a3979","repo":"vercel-labs/agent-skills","slug":"daily-quota-exceeded","errorCode":"DAILY_QUOTA_EXCEEDED","errorMessage":"DAILY_QUOTA_EXCEEDED","messagePattern":"DAILY_QUOTA_EXCEEDED","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"skills/vercel-optimize/lib/throttle.mjs","lineNumber":264,"sourceCode":"export function getDailyQuotaBlock(nowMs = Date.now()) {\n  if (!dailyQuotaBlock) return null;\n  if (dailyQuotaBlock.untilMs <= nowMs) {\n    dailyQuotaBlock = null;\n    return null;\n  }\n  return dailyQuotaBlock;\n}\n\nexport function utcMidnightAfter(nowMs) {\n  const d = new Date(nowMs);\n  return Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate() + 1);\n}\n\nfunction dailyQuotaResult(block, sourceResult = null) {\n  return {\n    ...(sourceResult && typeof sourceResult === 'object' ? sourceResult : {}),\n    ok: false,\n    code: 'DAILY_QUOTA_EXCEEDED',\n    message: block.message,\n    cachedUntil: new Date(block.untilMs).toISOString(),\n    originalCode: sourceResult?.originalCode ?? sourceResult?.code ?? block.originalCode ?? undefined,\n  };\n}\n\nfunction defaultSleep(ms) {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","sourceCodeStart":246,"sourceCodeEnd":274,"githubUrl":"https://github.com/vercel-labs/agent-skills/blob/b8caa260a420a73042e35521de4b5c8baf6446cc/skills/vercel-optimize/lib/throttle.mjs#L246-L274","documentation":"Constructed by dailyQuotaResult() from a cached dailyQuotaBlock and returned (not thrown) when the Vercel Observability daily query quota was exhausted earlier in the session. setDailyQuotaBlocked() records the block with untilMs = next UTC midnight (utcMidnightAfter); subsequent metric calls short-circuit via getDailyQuotaBlock() and return this synthetic {ok:false, code:'DAILY_QUOTA_EXCEEDED', cachedUntil} result, preserving the original failing code/ message. This avoids hammering the API after the limit is hit.","triggerScenarios":"collect-signals (or any metrics query) triggered the Observability daily limit; isDailyQuotaExceeded() detected it; setDailyQuotaBlocked() cached the block; every later metrics/usage call returns DAILY_QUOTA_EXCEEDED until the next UTC midnight resets it.","commonSituations":"A large project with many routes exhausting the daily Observability query budget; repeated collect-signals runs in the same day compounding usage; a team on a plan with a low Observability query ceiling.","solutions":["Wait until the cachedUntil timestamp (next UTC midnight) for the quota to reset, then rerun.","Reduce query volume: narrow the time window, fewer routes/groupBy dimensions, or run collect-signals once per day.","Upgrade the Vercel plan / Observability tier to raise the daily query ceiling.","If a stale block lingers, it clears automatically at UTC midnight via getDailyQuotaBlock's untilMs check."],"exampleFix":"// before — block active, every call returns the quota error\nconst r = await runMetrics(...); // r.code === 'DAILY_QUOTA_EXCEEDED', cachedUntil set\n\n// after — check the block first and degrade gracefully\nimport { getDailyQuotaBlock } from './lib/throttle.mjs';\nconst block = getDailyQuotaBlock();\nif (block) {\n  console.warn(`Observability quota exhausted until ${new Date(block.untilMs).toISOString()}; using cached signals.`);\n  return cachedSignals;\n}\nconst r = await runMetrics(...);","handlingStrategy":"fallback","validationCode":"import { getDailyQuotaBlock } from './lib/throttle.mjs';\n// before issuing any metrics query\nconst block = getDailyQuotaBlock();\nif (block) {\n  console.warn(`Daily Observability quota exhausted until ${new Date(block.untilMs).toISOString()}`);\n  return cachedOrPartialSignals; // degrade instead of hitting the limit again\n}","typeGuard":"function isDailyQuotaResult(r) {\n  return !!r && r.ok === false && r.code === 'DAILY_QUOTA_EXCEEDED';\n}","tryCatchPattern":"const r = await runMetrics(...);\nif (isDailyQuotaResult(r)) {\n  // not a throw — a returned result: fall back to cached signals and surface cachedUntil\n  console.warn(`Quota hit; using cached signals until ${r.cachedUntil}`);\n  return cachedSignals;\n}\nreturn r;","preventionTips":["Run collect-signals once per day to conserve the Observability query budget.","Narrow the time window and groupBy cardinality to reduce per-query cost.","Check getDailyQuotaBlock() before every metrics call so you degrade early.","Upgrade the Observability tier if the daily ceiling is consistently too low."],"tags":["quota","rate-limit","observability","vercel"],"backgroundTag":null,"analyzedSha":"b8caa260a420a73042e35521de4b5c8baf6446cc","analyzedAt":"2026-08-13T06:03:29.508Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}