jackwener/OpenCLI · error · ArgumentError
flomo memos --since must be a safe integer Unix timestamp in
Error message
flomo memos --since must be a safe integer Unix timestamp in seconds
What it means
Thrown by parseSinceArg in clis/flomo/memos.js:46 when --since is digits-only but the parsed Number is not a safe integer (exceeds Number.MAX_SAFE_INTEGER, ~9.007e15). This guards against absurdly long numeric strings that JavaScript cannot represent exactly, which would corrupt the timestamp sent to the API.
Source
Thrown at clis/flomo/memos.js:46
}
const parsed = Number(text);
if (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > max) {
throw new ArgumentError(`flomo memos --${name} must be between 1 and ${max}`);
}
return parsed;
}
function parseSinceArg(value) {
if (value === undefined || value === null || value === '') {
return 0;
}
const text = String(value).trim();
if (!/^\d+$/.test(text)) {
throw new ArgumentError('flomo memos --since must be a non-negative Unix timestamp in seconds');
}
const parsed = Number(text);
if (!Number.isSafeInteger(parsed)) {
throw new ArgumentError('flomo memos --since must be a safe integer Unix timestamp in seconds');
}
return parsed;
}
function parseSlugArg(value) {
if (value === undefined || value === null || value === '') {
return '';
}
const slug = String(value).trim();
if (!/^[A-Za-z0-9_-]{1,256}$/.test(slug)) {
throw new ArgumentError('flomo memos --slug must be an opaque memo cursor containing only letters, numbers, _ or -');
}
return slug;
}
function buildSignedUrl(limit, since, slug) {
const params = {
limit: String(limit),View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the timestamp length: Unix seconds should be ~10 digits; trim extra digits or duplication.
- Convert from nanoseconds/milliseconds to seconds by trimming the trailing digits (e.g. 19→10 digits).
- Recompute the timestamp: `date +%s`.
- Omit --since if a time filter is not needed.
Example fix
// before flomo memos --since 1704067200000000000 # nanoseconds // after flomo memos --since 1704067200
Defensive patterns
Strategy: validation
Validate before calling
if (!Number.isSafeInteger(Number(since)) || String(since).length > 11) {
throw new Error('since too large; expected unix seconds (10 digits)');
} Type guard
function isSafeUnixSeconds(v) { const n = Number(v); return Number.isSafeInteger(n) && n >= 0 && n <= Number.MAX_SAFE_INTEGER; } Try / catch
try {
await runMemos({ since });
} catch (err) {
if (err.name === 'ArgumentError' && err.message.includes('safe integer')) {
since = Math.floor(Number(since) / 1000); // likely ms or ns input
} else { throw err; }
} Prevention
- Check the source unit of your timestamp (s vs ms vs ns) before passing it.
- Use BigInt or string handling if you must process very large numeric values.
- Regenerate timestamps with `date +%s` rather than copying from logs.
- Treat 19-20 digit values as a red flag for nanosecond timestamps.
When it happens
Trigger: `flomo memos --since 99999999999999999999` — a 20+ digit value, typically a millisecond-with-extra-digits timestamp or a concatenated/garbled number. Extremely unlikely with genuine Unix-seconds timestamps (currently 10 digits).
Common situations: Concatenating timestamps by mistake, pasting a nanosecond timestamp (19 digits) from a Go or Java log, or a duplicated value from a copy/paste error.
Related errors
- <train-no> "${trainNo}" does not look like a 12306 internal
- --from station must not be empty
- --to station must not be empty
- --seat-types must contain only 12306 seat letters/digits (A-
- --from and --to must differ; both resolved to ${fromStation.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1da85ead7cebd54e.
Report an issue: GitHub.