stablyai/orca · error · Error

Hourly build timestamp is invalid.

Error message

Hourly build timestamp is invalid.

What it means

Thrown by createHourlyBuildVersion() when the date argument is not a Date instance or is an Invalid Date (getTime() returns NaN). The timestamp is formatted to UTC minute precision for the hourly version suffix, so a usable Date is required.

Source

Thrown at config/scripts/hourly-build-version.mjs:18

import { execFileSync } from 'node:child_process'
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { formatReleaseTitleTimestamp } from './release-title-timestamp.mjs'
import {
  readPublishedVersionsFromEnv,
  resolveDevChannelBaseVersion
} from './dev-channel-base-version.mjs'

/** `1.4.160-hourly.202607281400` — UTC to the minute, so tags sort chronologically
 *  by semver and every build is uniquely versioned. */
export function createHourlyBuildVersion(baseVersion, date) {
  const match = /^(\d+\.\d+\.\d+)(?:-[0-9A-Za-z.-]+)?$/.exec(baseVersion)
  if (!match) {
    throw new Error(`Package version is not valid semver: ${baseVersion}`)
  }
  if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
    throw new Error('Hourly build timestamp is invalid.')
  }
  const pad = (value, width = 2) => String(value).padStart(width, '0')
  const stamp = [
    pad(date.getUTCFullYear(), 4),
    pad(date.getUTCMonth() + 1),
    pad(date.getUTCDate()),
    pad(date.getUTCHours()),
    pad(date.getUTCMinutes())
  ].join('')
  // Why: drop any -rc.N tail. Keeping it makes every hourly semver-NEWER than the
  // RC it was cut from (1.4.160-rc.3-hourly.X > 1.4.160-rc.3), which would let an
  // ordinary RC-channel check offer untested hourly builds to RC users. Stripping
  // to the base parks hourlies below both rc.N and stable ('hourly' < 'rc'
  // alphabetically), reachable only by an explicit pinned jump.
  return `${match[1]}-hourly.${stamp}`
}

/**

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Pass a valid Date object: `new Date()` or `new Date(validTimestamp)`.
  2. If converting from a string, construct the Date first and check `Number.isNaN(date.getTime())`.
  3. Default the parameter (`now = new Date()`) so callers can omit it.

Example fix

// before
createHourlyBuildVersion('1.4.0', '2026-07-28T14:00:00Z')  // string, throws
// after
createHourlyBuildVersion('1.4.0', new Date('2026-07-28T14:00:00Z'))
Defensive patterns

Strategy: type-guard

Validate before calling

function assertValidDate(d: unknown): asserts d is Date {
  if (!(d instanceof Date) || Number.isNaN(d.getTime())) {
    throw new Error('Hourly build timestamp is invalid.')
  }
}
assertValidDate(date)

Type guard

const isValidDate = (d: unknown): d is Date =>
  d instanceof Date && !Number.isNaN(d.getTime())

Prevention

When it happens

Trigger: Passing a string/number/null instead of a Date, passing `new Date('invalid')`, or passing a Date constructed from a bad timestamp.

Common situations: Caller passing a raw ISO string instead of `new Date(isoString)`, a Date constructed from undefined/NaN, or a timezone-parsing edge case producing Invalid Date.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/905be99570647818. Report an issue: GitHub.