{"record":{"id":"8e3c1e124d138718","repo":"mastra-ai/mastra","slug":"platform-github-pull-request-reconcile-interval-mu","errorCode":null,"errorMessage":"Platform GitHub pull request reconcile interval must be a positive number.","messagePattern":"Platform GitHub pull request reconcile interval must be a positive number\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/factory/src/integrations/platform/github/event-worker.ts","lineNumber":153,"sourceCode":"  constructor(config: PlatformGithubEventWorkerConfig) {\n    super();\n    this.#client = config.client;\n    this.#controller = config.controller;\n    this.#github = config.github;\n    this.#storage = config.storage;\n    this.#ingestFactoryEvent = config.ingestFactoryEvent;\n    this.#reconcileFactoryState = config.reconcileFactoryState;\n    this.#reconcileIssuesFactoryState = config.reconcileIssuesFactoryState;\n    this.#pollEventsEnabled = config.pollEventsEnabled ?? true;\n    const legacyReconcileIntervalMs = config.reconcileIntervalMs ?? DEFAULT_RECONCILE_INTERVAL_MS;\n    this.#pullRequestReconcileIntervalMs = config.pullRequestReconcileIntervalMs ?? legacyReconcileIntervalMs;\n    this.#issueReconcileIntervalMs = config.issueReconcileIntervalMs ?? legacyReconcileIntervalMs;\n    this.#intervalMs = config.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n    if (!Number.isFinite(this.#intervalMs) || this.#intervalMs <= 0) {\n      throw new Error('Platform GitHub event polling interval must be a positive number.');\n    }\n    if (!Number.isFinite(this.#pullRequestReconcileIntervalMs) || this.#pullRequestReconcileIntervalMs <= 0) {\n      throw new Error('Platform GitHub pull request reconcile interval must be a positive number.');\n    }\n    if (!Number.isFinite(this.#issueReconcileIntervalMs) || this.#issueReconcileIntervalMs <= 0) {\n      throw new Error('Platform GitHub issue reconcile interval must be a positive number.');\n    }\n    this.#leaseTtlMs = Math.max(\n      MIN_LEASE_TTL_MS,\n      Math.min(this.#intervalMs, this.#pullRequestReconcileIntervalMs, this.#issueReconcileIntervalMs) * 3,\n    );\n    this.#now = config.now ?? Date.now;\n    this.#dispatch = config.dispatch ?? dispatchGithubWebhook;\n    this.#sourceControl = config.sourceControl;\n  }\n\n  async init(deps: WorkerDeps): Promise<void> {\n    await super.init(deps);\n    this.#leaseProvider = getLeaseProvider(deps.pubsub);\n  }\n","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/factory/src/integrations/platform/github/event-worker.ts#L135-L171","documentation":"Thrown from the PlatformGithubEventWorker constructor (event-worker.ts:153) when config.pullRequestReconcileIntervalMs (or its legacy alias reconcileIntervalMs) is provided but is not a finite number greater than 0. This interval controls how often open pull requests are reconciled with GitHub; a non-positive value would cause a hot loop, so the constructor rejects it immediately.","triggerScenarios":"new PlatformGithubEventWorker({ ..., pullRequestReconcileIntervalMs: 0 }) or a negative/NaN/Infinity value; the same via the legacy config.reconcileIntervalMs field when pullRequestReconcileIntervalMs is not set.","commonSituations":"Legacy config migration: reconcileIntervalMs was computed (e.g. from a division or parsed env var) and ended up 0 or NaN; config files edited to 'speed up' reconciliation with 0; typed config objects built from unvalidated JSON.","solutions":["Set pullRequestReconcileIntervalMs to a positive finite number of milliseconds.","Fix the legacy reconcileIntervalMs value, or set both pullRequestReconcileIntervalMs and issueReconcileIntervalMs explicitly to override it.","Omit the field to fall back to DEFAULT_RECONCILE_INTERVAL_MS.","Guard computed values with Number.isFinite(v) && v > 0 before constructing the worker."],"exampleFix":"// before\nnew PlatformGithubEventWorker({ reconcileIntervalMs: Number(process.env.RECONCILE_MS) });\n\n// after\nconst ms = Number(process.env.RECONCILE_MS);\nnew PlatformGithubEventWorker({\n  ...(Number.isFinite(ms) && ms > 0 ? { reconcileIntervalMs: ms } : {}),\n});","handlingStrategy":"validation","validationCode":"const raw = config.pullRequestReconcileIntervalMs ?? config.reconcileIntervalMs;\nif (raw !== undefined && !(Number.isFinite(Number(raw)) && Number(raw) > 0)) {\n  throw new TypeError(`pullRequestReconcileIntervalMs must be positive, got ${String(raw)}`);\n}","typeGuard":"function isValidInterval(v: unknown): v is number {\n  return typeof v === 'number' && Number.isFinite(v) && v > 0;\n}","tryCatchPattern":"try {\n  const worker = new PlatformGithubEventWorker(config);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('pull request reconcile interval')) {\n    logger.error('Invalid pullRequestReconcileIntervalMs; check legacy reconcileIntervalMs', { value: config.reconcileIntervalMs });\n  }\n  throw err;\n}","preventionTips":["When migrating from legacy reconcileIntervalMs, set both PR and issue intervals explicitly.","Sanitize any computed/derived interval (division, env parse) before assigning it.","Schema-validate config at process startup so failures happen before workers construct.","Prefer omitting the field over supplying 0 as a placeholder."],"tags":["configuration","validation","github","worker"],"backgroundTag":"invalid-configuration-value","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}