jackwener/OpenCLI · error · ArgumentError
flomo memos --since must be a non-negative Unix timestamp in
Error message
flomo memos --since must be a non-negative Unix timestamp in seconds
What it means
Thrown by parseSinceArg in clis/flomo/memos.js:42 when the --since option is present but is not a non-negative Unix timestamp in seconds (digits-only check fails). The library uses --since as a numeric time filter for the memos API, so any value with signs, decimals, units, or letters is rejected before a request is made.
Source
Thrown at clis/flomo/memos.js:42
}
const text = String(value).trim();
if (!/^\d+$/.test(text)) {
throw new ArgumentError(`flomo memos --${name} must be a positive integer`);
}
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;
}View on GitHub (pinned to 49907e53dc)
Solutions
- Convert the date to Unix seconds first: `date -d 2024-01-01 +%s` (GNU) or `date -j -f %Y-%m-%d 2024-01-01 +%s` (BSD).
- If your timestamp is in milliseconds (13 digits), divide by 1000: `flomo memos --since $(( MS / 1000 ))`.
- Pass a plain integer string like `flomo memos --since 1704067200`.
- Omit --since to fetch memos without a time filter.
Example fix
// before flomo memos --since 2024-01-01 // after flomo memos --since $(date -d 2024-01-01 +%s)
Defensive patterns
Strategy: validation
Validate before calling
const since = Math.floor(new Date('2024-01-01T00:00:00Z').getTime() / 1000);
if (!/^\d+$/.test(String(since))) throw new Error('since must be unix seconds'); Type guard
function isUnixSeconds(v) { const n = Number(v); return Number.isSafeInteger(n) && n >= 0 && n < 1e11; } Try / catch
try {
await runMemos({ since });
} catch (err) {
if (err.name === 'ArgumentError' && err.message.includes('--since')) {
since = Math.floor(Date.now() / 1000); // or recompute from date
} else { throw err; }
} Prevention
- Always convert dates with `date -d ... +%s` or Math.floor(Date.parse(x)/1000).
- Remember the CLI expects seconds, not milliseconds — divide Date.now() by 1000.
- Never pass ISO strings, floats, or signed numbers to --since.
- Sanity-check digit count: unix seconds are ~10 digits.
When it happens
Trigger: `flomo memos --since 2024-01-01` (date string), `--since 1700000000.5` (float), `--since +1700000000` (leading plus), `--since "1_700_000_000"` (underscores), or `--since "1700000000 seconds"`. Note millisecond timestamps are digits-only so they pass this error but likely produce wrong filtering.
Common situations: Passing an ISO date string instead of a Unix timestamp, copying a timestamp in milliseconds from JS Date.now(), or using a locale-formatted date from a spreadsheet or log file.
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/57ca9a599ec48652.
Report an issue: GitHub.