{"record":{"id":"6cd18b1269f1d183","repo":"mastra-ai/mastra","slug":"platform-linear-reconcile-interval-must-be-a-posit","errorCode":null,"errorMessage":"Platform Linear reconcile interval must be a positive number.","messagePattern":"Platform Linear reconcile interval must be a positive number\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/factory/src/integrations/platform/linear/event-worker.ts","lineNumber":160,"sourceCode":"  #settings: PlatformLinearEventWorkerSettings = { version: 1, workspaces: {} };\n\n  constructor(config: PlatformLinearEventWorkerConfig) {\n    super();\n    this.#client = config.client;\n    this.#linear = config.linear;\n    this.#storage = config.storage;\n    this.#projects = config.projects;\n    this.#workItems = config.workItems;\n    this.#ingestFactoryIssue = config.ingestFactoryIssue;\n    this.#reconcileFactoryState = config.reconcileFactoryState;\n    this.#pollEventsEnabled = config.pollEventsEnabled ?? true;\n    this.#intervalMs = config.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n    this.#reconcileIntervalMs = config.reconcileIntervalMs ?? DEFAULT_RECONCILE_INTERVAL_MS;\n    if (!Number.isFinite(this.#intervalMs) || this.#intervalMs <= 0) {\n      throw new Error('Platform Linear event polling interval must be a positive number.');\n    }\n    if (!Number.isFinite(this.#reconcileIntervalMs) || this.#reconcileIntervalMs <= 0) {\n      throw new Error('Platform Linear reconcile interval must be a positive number.');\n    }\n    this.#leaseTtlMs = Math.max(MIN_LEASE_TTL_MS, this.#intervalMs * 3);\n    this.#now = config.now ?? Date.now;\n  }\n\n  async init(deps: WorkerDeps): Promise<void> {\n    await super.init(deps);\n    this.#leaseProvider = getLeaseProvider(deps.pubsub);\n  }\n\n  async start(): Promise<void> {\n    if (this.#running) return;\n    if (!this.deps) throw new Error('PlatformLinearEventWorker: call init() before start()');\n\n    this.#startedAt = this.#now() - 1;\n    this.#settings = normalizeSettings(await this.#storage.settings.get(CURSOR_ORG_ID, CURSOR_USER_ID));\n    this.#running = true;\n    this.deps.logger.info('Platform Linear event polling started', {","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/factory/src/integrations/platform/linear/event-worker.ts#L142-L178","documentation":"The Platform Linear event worker constructor validates that the state reconciliation interval (`config.reconcileIntervalMs`) is a finite number greater than 0. The default (`DEFAULT_RECONCILE_INTERVAL_MS`) applies only when the option is omitted, so this error means an explicit value of 0, a negative number, NaN, or Infinity was supplied. It throws in the constructor so a bad reconcile schedule is caught at boot, not at first reconcile.","triggerScenarios":"Constructing the Linear event worker with `reconcileIntervalMs: 0`, a negative value, NaN, or Infinity — e.g. `reconcileIntervalMs: Number(process.env.LINEAR_RECONCILE_MS)` where the env var is empty string (NaN) or '0'.","commonSituations":"Empty or unset env var coerced to NaN via Number(''); ops setting the value to 0 to 'turn off' reconciliation; a unit-test fixture passing 0 and expecting the default.","solutions":["Set `reconcileIntervalMs` to a finite positive number of milliseconds (e.g. 300000).","Delete the `reconcileIntervalMs` option to fall back to DEFAULT_RECONCILE_INTERVAL_MS.","Fix the underlying env var so it is blank/absent (use ?? undefined, not Number('')) or a valid positive integer.","Sanitize before passing: only assign the value when `Number.isFinite(v) && v > 0`."],"exampleFix":"// before\nnew LinearEventWorker({ reconcileIntervalMs: Number(process.env.LINEAR_RECONCILE_MS) });\n// after\nconst raw = process.env.LINEAR_RECONCILE_MS?.trim();\nconst parsed = raw ? Number(raw) : undefined;\nnew LinearEventWorker({ reconcileIntervalMs: parsed !== undefined && Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined });","handlingStrategy":"validation","validationCode":"const raw = process.env.LINEAR_RECONCILE_MS?.trim();\nconst reconcileIntervalMs = raw === undefined || raw === '' ? undefined : Number(raw);\nif (reconcileIntervalMs !== undefined && !(Number.isFinite(reconcileIntervalMs) && reconcileIntervalMs > 0)) {\n  throw new Error(`LINEAR_RECONCILE_MS must be a positive number, got: ${raw}`);\n}","typeGuard":"function isPositiveFiniteNumber(v: unknown): v is number {\n  return typeof v === 'number' && Number.isFinite(v) && v > 0;\n}","tryCatchPattern":null,"preventionTips":["Treat empty env strings as 'unset' (undefined), not as Number('') = NaN.","Only pass reconcileIntervalMs when it validates; otherwise omit for the default.","Add a startup config lint step that validates all interval env vars together."],"tags":["configuration","validation","linear","polling"],"backgroundTag":"invalid-interval-config","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}