ruvnet/ruflo · error · Error
Invalid timestamp format
Error message
Invalid timestamp format: "${value}". Expected ISO 8601. What it means
validateTimestamp() in ruvector/pg-utils.ts accepts only ISO 8601 timestamps (YYYY-MM-DD[T ]HH:MM:SS with optional fractional seconds and optional Z/±HH:MM zone) so values can be embedded in SQL without quoting risk. Epoch numbers, slash-formatted dates, locale strings, and Date.prototype.toString() output all fail the regex.
Solutions
- Convert in JS before passing: new Date(value).toISOString() always satisfies the regex
- Have the producer emit 'YYYY-MM-DDTHH:MM:SS.sssZ' (toISOString format)
- If you only have a calendar date, append T00:00:00Z to make it valid
Example fix
// before const ts = new Date().toString(); // 'Tue Aug 18 2026 ...' // after const ts = new Date().toISOString(); // '2026-08-18T10:00:00.000Z'
Defensive patterns
Strategy: validation
Validate before calling
const ISO_RE = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/;
const ts = ISO_RE.test(value) ? value : new Date(value).toISOString();
await runImport({ timestamp: ts }); Type guard
function isIso8601Timestamp(v: unknown): v is string {
return typeof v === 'string' && /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/.test(v);
} Prevention
- Always emit timestamps via Date.prototype.toISOString() at the producer
- Reject epoch numbers and locale strings at your system boundary
- A date-only value is not enough — append T00:00:00Z when no time exists
When it happens
Trigger: Passing 1712345678 (epoch seconds), '2026/08/18 10:00:00' (slashes), 'Tue Aug 18 2026 10:00:00 GMT+0000' (Date.toString()), or a date-only value '2026-08-18' with no time component.
Common situations: Feeding timestamps exported from databases in locale format; forgetting to call .toISOString() on a Date; producers emitting RFC 2822 or unix time.
Related errors
- Invalid embedding value at index
- Invalid schema name: " ". Must contain only letters…
- Schema name must not be empty
- must be an ISO timestamp
- run completedAt precedes startedAt
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/997d45c2e48003e8.
Report an issue: GitHub.
Appendix: source
Thrown at v3/@claude-flow/cli/src/commands/ruvector/pg-utils.ts:43
throw new Error(`Schema name too long (${schema.length} chars, max 63): "${schema}"`);
}
if (!VALID_PG_IDENTIFIER.test(schema)) {
throw new Error(
`Invalid schema name: "${schema}". Must contain only letters, digits, and underscores, and start with a letter or underscore.`
);
}
return schema;
}
/**
* Validate a PostgreSQL timestamp string.
* Only allows ISO 8601 format to prevent SQL injection via timestamp fields.
*/
const VALID_TIMESTAMP = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/;
export function validateTimestamp(value: string): string {
if (!VALID_TIMESTAMP.test(value)) {
throw new Error(`Invalid timestamp format: "${value}". Expected ISO 8601.`);
}
return value;
}
View on GitHub (pinned to fa13ee4ad6)