Hmbown/CodeWhale · error · Error

GitHub timestamp is invalid

Error message

GitHub ${label} timestamp is invalid: ${value}

What it means

Strict timestamp parsing in the release-asset verifier: Date.parse returned NaN for the given GitHub ${label} field (created/updated time from an API response). GitHub timestamps are ISO-8601; a non-finite parse means the API returned a missing, malformed, or truncated date, and the freshness check cannot proceed safely.

Solutions

  1. Print the offending record and confirm the date field exists and is ISO 8601.
  2. Ensure the release job's started_at is populated (rerun the workflow if the run record is incomplete).
  3. If you inject API fixtures, include valid RFC 3339 timestamps.

Example fix

// before
{ database_id: 42 }
// after
{ database_id: 42, run_started_at: "2026-09-15T00:00:00Z" }
Defensive patterns

Strategy: validation

Validate before calling

for (const t of [run.run_started_at, release.created_at]) { if (!t || Number.isNaN(Date.parse(t))) throw new Error(`Missing/invalid timestamp: ${t}`); }

Type guard

const isIsoTimestamp = (v) => typeof v === "string" && Number.isFinite(Date.parse(v));

Try / catch

try { verifyFreshness(release, expected, run); } catch (e) { if (e.message.startsWith("GitHub ") && e.message.includes("timestamp is invalid")) { console.error("API record missing a valid date; refetch or rerun the workflow."); } else throw e; }

Prevention

When it happens

Trigger: Any timestamp passed to parseGitHubTime (asset updated_at/created_at, run started_at, release created_at) that is undefined, empty, or not parseable by Date.parse.

Common situations: A run record lacking started_at/created_at; a mocked or hand-built response object missing date fields; clock/locale anomalies in locally constructed test data.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/77959774d7167874. Report an issue: GitHub.

Appendix: source

Thrown at npm/codewhale/scripts/verify-release-assets.js:261

    }
  }

  if (orderedCandidates.length === 0) {
    throw new Error(
      `No release.yml workflow run found for ${tag} at ${tagSha}. ` +
        "Rerun the Release workflow before publishing npm, or increase the verifier's last-100-runs search window.",
    );
  }
  throw new Error(
    `No successful asset-publishing job found in release.yml workflow runs for ${tag} at ${tagSha}. ` +
      "Repair the Release workflow before publishing npm.",
  );
}

function parseGitHubTime(value, label) {
  const timestamp = Date.parse(value);
  if (!Number.isFinite(timestamp)) {
    throw new Error(`GitHub ${label} timestamp is invalid: ${value}`);
  }
  return timestamp;
}

function assertReleaseAssetsFresh(release, expectedAssets, run) {
  const assetsByName = new Map((release.assets || []).map((asset) => [asset.name, asset]));
  const missing = expectedAssets.filter((asset) => !assetsByName.has(asset));
  if (missing.length > 0) {
    throw new Error(`GitHub Release is missing required release asset(s): ${missing.join(", ")}`);
  }

  // #5429: compare against the successful release job's started_at when the
  // run record carries it; fall back to the run-level timestamp only when a
  // job baseline is unavailable.
  const baseline = run.release_job_started_at || run.run_started_at || run.created_at;
  const baselineLabel = run.release_job_started_at ? "release job start" : "workflow run start";
  const freshnessBaseline = parseGitHubTime(baseline, baselineLabel);
  const stale = [];

View on GitHub (pinned to 433685b202)