Hmbown/CodeWhale · error · Error
Runtime event seq is missing a usable timestamp.
Error message
Runtime event seq ${rec.seq} is missing a usable timestamp. What it means
Thrown while converting raw runtime records into events: a record's timestamp could not be parsed into a usable time (parseTime returned undefined), so no relative start time can be computed. Every retained record must be placeable on the timeline; one unreadable timestamp aborts the whole import. The message includes rec.seq to identify the offending record.
Solutions
- Inspect the record with the reported seq in the runtime file and fix or restore its timestamp.
- Re-export the thread; a complete export should always carry timestamps.
- Normalize timestamps to ISO 8601 strings the parser accepts before importing.
- Filter out records without a valid timestamp (acknowledging the whole-file abort this error implies) via a pre-parse validation pass.
Example fix
// before
const events = runtime.feed(threadId, lines.map(JSON.parse));
// after
const records = lines.map(JSON.parse);
const bad = records.find(r => r.timestamp === undefined || Number.isNaN(Date.parse(r.timestamp)));
if (bad) throw new Error(`Record seq ${bad.seq} has bad timestamp`);
const events = runtime.feed(threadId, records); Defensive patterns
Strategy: validation
Validate before calling
const bad = records.find(r => r.timestamp === undefined || Number.isNaN(Date.parse(r.timestamp)));
if (bad) throw new Error(`Record seq ${bad.seq} has unusable timestamp ${JSON.stringify(bad.timestamp)}`); Type guard
function hasUsableTimestamp(rec) {
return rec != null && typeof rec.timestamp === 'string' && !Number.isNaN(Date.parse(rec.timestamp));
} Try / catch
try {
runtime.import(file, threadId);
} catch (e) {
const m = /seq (\d+) is missing a usable timestamp/.exec(e.message);
if (m) console.error(`Bad timestamp on record seq ${m[1]}; re-export or repair that record.`);
else throw e;
} Prevention
- Pre-validate all timestamps (ISO 8601) before feeding records to the importer.
- Avoid hand-editing export files; re-export instead.
- Keep exporter and importer schema versions aligned.
- Check for truncated writes if exports come from interrupted sessions.
When it happens
Trigger: Importing a Codewhale runtime file where a record (identified by its seq field) has a missing, malformed, or unsupported timestamp value so parseTime(rec.timestamp) yields undefined at pet/ios/Resources/pet-native.js:2303.
Common situations: An export interrupted mid-write leaving a record with an empty timestamp; a timestamp in a format the parser does not recognize (e.g. relative seconds instead of ISO 8601); hand-edited or filtered JSONL files; a version change in the runtime record schema.
Related errors
- Invalid Runtime observation horizon.
- Runtime event seq is missing a usable timestamp.
- Runtime event seq is missing a usable timestamp.
- A managed, project or plugin connector already uses this…
- Antigravity import requires an agy_cli grant, not
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/428190ae425d4196.
Report an issue: GitHub.
Appendix: source
Thrown at pet/ios/Resources/pet-native.js:2303
this.sizes.delete(event);
if (this.open.get(event.id) === event)
this.open.delete(event.id);
}
}
this.events.length = keep;
}
append(records) {
if (!records.length)
return;
const { events, open, requests } = this;
const threadId = this.threadId ?? str(obj(records[0]).thread_id) ?? this.filename;
this.threadId = threadId;
let { origin, model, skippedDeltas } = this;
let threadName = this.threadName ?? threadId;
const stamp = (rec) => {
const t = parseTime(rec.timestamp);
if (t === undefined)
throw new Error(`Runtime event seq ${rec.seq} is missing a usable timestamp.`);
if (origin === undefined)
origin = t;
return t - origin;
};
for (const raw of records) {
if (!isCodewhaleRuntimeRecord(raw))
throw new Error('Runtime import cancelled: a line is not a Codewhale runtime event record. No rows were skipped.');
this.recordCount++;
const rec = obj(raw);
if (rec.thread_id !== threadId)
throw new Error('Runtime import contains multiple threads. Export one thread before importing.');
const eventName = rec.event;
if (eventName === 'item.delta') {
skippedDeltas++;
continue;
}
const payload = obj(rec.payload);
const item = obj(payload.item);View on GitHub (pinned to 433685b202)