ruvnet/ruflo · error · Error
Invalid timestamp format: "${value}". Expected ISO 8601.
Error message
Invalid timestamp format: "${value}". Expected ISO 8601. What it means
Thrown by validateTimestamp() when the value fails the ISO-8601 regex VALID_TIMESTAMP. Timestamps are interpolated into SQL, so only the strict ISO grammar is accepted to prevent injection via timestamp fields; loose date strings or locale-formatted times are rejected.
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 6b01dc5a68)
Solutions
- Emit timestamps via `new Date(...).toISOString()` which always yields the accepted form.
- If you have a date-only, append 'T00:00:00Z' before validating.
- If you have an epoch, convert with `new Date(epochMs).toISOString()`.
Example fix
// before
validateTimestamp('2024-08-12')
// after
validateTimestamp(new Date('2024-08-12').toISOString()) // 2024-08-12T00:00:00.000Z Defensive patterns
Strategy: validation
Validate before calling
function toIsoTimestamp(v: string | number | Date): string {
const iso = new Date(v).toISOString();
// re-validate to satisfy the strict regex
return validateTimestamp(iso);
} Type guard
const ISO_8601 = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/;
const isIsoTimestamp = (v: unknown): v is string =>
typeof v === 'string' && ISO_8601.test(v); Try / catch
try {
validateTimestamp(value);
} catch (e) {
const msg = e instanceof Error ? e.message : String(e);
if (msg.startsWith('Invalid timestamp format')) {
value = new Date(value).toISOString(); // normalize once
} else throw e;
} Prevention
- Always emit timestamps via Date.prototype.toISOString().
- Append 'T00:00:00Z' to date-only values.
- Never pass locale-formatted or epoch-as-string timestamps.
When it happens
Trigger: Passing a timestamp like '2024/08/12', 'Aug 12 2024', '2024-08-12' (date-only, no time component — the regex requires a time), epoch numbers coerced to string, or values with embedded SQL.
Common situations: Locale-formatted dates from spreadsheets/log exports, date-only values where the column expects a timestamp, epoch seconds passed as a string, or non-UTC offsets in unusual formats.
Related errors
- Schema name must not be empty
- Invalid schema name: "${schema}". Must contain only letters,
- Schema name too long (${schema.length} chars, max 63): "${sc
- Validation failed: ${result.error}
- Header JSON exceeds maximum size (${headerLen} > ${MAX_HEADE
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/997d45c2e48003e8.
Report an issue: GitHub.