mastra-ai/mastra · error
Platform GitHub pull request reconcile interval must be a po
Error message
Platform GitHub pull request reconcile interval must be a positive number.
What it means
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.
Source
Thrown at mastracode/factory/src/integrations/platform/github/event-worker.ts:153
constructor(config: PlatformGithubEventWorkerConfig) {
super();
this.#client = config.client;
this.#controller = config.controller;
this.#github = config.github;
this.#storage = config.storage;
this.#ingestFactoryEvent = config.ingestFactoryEvent;
this.#reconcileFactoryState = config.reconcileFactoryState;
this.#reconcileIssuesFactoryState = config.reconcileIssuesFactoryState;
this.#pollEventsEnabled = config.pollEventsEnabled ?? true;
const legacyReconcileIntervalMs = config.reconcileIntervalMs ?? DEFAULT_RECONCILE_INTERVAL_MS;
this.#pullRequestReconcileIntervalMs = config.pullRequestReconcileIntervalMs ?? legacyReconcileIntervalMs;
this.#issueReconcileIntervalMs = config.issueReconcileIntervalMs ?? legacyReconcileIntervalMs;
this.#intervalMs = config.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
if (!Number.isFinite(this.#intervalMs) || this.#intervalMs <= 0) {
throw new Error('Platform GitHub event polling interval must be a positive number.');
}
if (!Number.isFinite(this.#pullRequestReconcileIntervalMs) || this.#pullRequestReconcileIntervalMs <= 0) {
throw new Error('Platform GitHub pull request reconcile interval must be a positive number.');
}
if (!Number.isFinite(this.#issueReconcileIntervalMs) || this.#issueReconcileIntervalMs <= 0) {
throw new Error('Platform GitHub issue reconcile interval must be a positive number.');
}
this.#leaseTtlMs = Math.max(
MIN_LEASE_TTL_MS,
Math.min(this.#intervalMs, this.#pullRequestReconcileIntervalMs, this.#issueReconcileIntervalMs) * 3,
);
this.#now = config.now ?? Date.now;
this.#dispatch = config.dispatch ?? dispatchGithubWebhook;
this.#sourceControl = config.sourceControl;
}
async init(deps: WorkerDeps): Promise<void> {
await super.init(deps);
this.#leaseProvider = getLeaseProvider(deps.pubsub);
}
View on GitHub (pinned to 75dd419e61)
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.
Example fix
// before
new PlatformGithubEventWorker({ reconcileIntervalMs: Number(process.env.RECONCILE_MS) });
// after
const ms = Number(process.env.RECONCILE_MS);
new PlatformGithubEventWorker({
...(Number.isFinite(ms) && ms > 0 ? { reconcileIntervalMs: ms } : {}),
}); Defensive patterns
Strategy: validation
Validate before calling
const raw = config.pullRequestReconcileIntervalMs ?? config.reconcileIntervalMs;
if (raw !== undefined && !(Number.isFinite(Number(raw)) && Number(raw) > 0)) {
throw new TypeError(`pullRequestReconcileIntervalMs must be positive, got ${String(raw)}`);
} Type guard
function isValidInterval(v: unknown): v is number {
return typeof v === 'number' && Number.isFinite(v) && v > 0;
} Try / catch
try {
const worker = new PlatformGithubEventWorker(config);
} catch (err) {
if (err instanceof Error && err.message.includes('pull request reconcile interval')) {
logger.error('Invalid pullRequestReconcileIntervalMs; check legacy reconcileIntervalMs', { value: config.reconcileIntervalMs });
}
throw err;
} Prevention
- 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.
When it happens
Trigger: new PlatformGithubEventWorker({ ..., pullRequestReconcileIntervalMs: 0 }) or a negative/NaN/Infinity value; the same via the legacy config.reconcileIntervalMs field when pullRequestReconcileIntervalMs is not set.
Common situations: 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.
Understand the failure class
Background: "Invalid configuration value" and "Unsupported/Unknown setting value" errors: why libraries reject your config strings, numbers, and types — this error's family across 30 libraries.
Related errors
- Platform GitHub event polling interval must be a positive nu
- Platform GitHub issue reconcile interval must be a positive
- terminationGraceMs must be greater than zero.
- Worker command must be a non-empty executable path.
- ${name} must be greater than zero.
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/8e3c1e124d138718.
Report an issue: GitHub.