{"record":{"id":"57ca9a599ec48652","repo":"jackwener/OpenCLI","slug":"flomo-memos-since-must-be-a-non-negative-unix-ti","errorCode":null,"errorMessage":"flomo memos --since must be a non-negative Unix timestamp in seconds","messagePattern":"flomo memos --since must be a non-negative Unix timestamp in seconds","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/flomo/memos.js","lineNumber":42,"sourceCode":"  }\n  const text = String(value).trim();\n  if (!/^\\d+$/.test(text)) {\n    throw new ArgumentError(`flomo memos --${name} must be a positive integer`);\n  }\n  const parsed = Number(text);\n  if (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > max) {\n    throw new ArgumentError(`flomo memos --${name} must be between 1 and ${max}`);\n  }\n  return parsed;\n}\n\nfunction parseSinceArg(value) {\n  if (value === undefined || value === null || value === '') {\n    return 0;\n  }\n  const text = String(value).trim();\n  if (!/^\\d+$/.test(text)) {\n    throw new ArgumentError('flomo memos --since must be a non-negative Unix timestamp in seconds');\n  }\n  const parsed = Number(text);\n  if (!Number.isSafeInteger(parsed)) {\n    throw new ArgumentError('flomo memos --since must be a safe integer Unix timestamp in seconds');\n  }\n  return parsed;\n}\n\nfunction parseSlugArg(value) {\n  if (value === undefined || value === null || value === '') {\n    return '';\n  }\n  const slug = String(value).trim();\n  if (!/^[A-Za-z0-9_-]{1,256}$/.test(slug)) {\n    throw new ArgumentError('flomo memos --slug must be an opaque memo cursor containing only letters, numbers, _ or -');\n  }\n  return slug;\n}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/flomo/memos.js#L24-L60","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":"// before\nflomo memos --since 2024-01-01\n// after\nflomo memos --since $(date -d 2024-01-01 +%s)","handlingStrategy":"validation","validationCode":"const since = Math.floor(new Date('2024-01-01T00:00:00Z').getTime() / 1000);\nif (!/^\\d+$/.test(String(since))) throw new Error('since must be unix seconds');","typeGuard":"function isUnixSeconds(v) { const n = Number(v); return Number.isSafeInteger(n) && n >= 0 && n < 1e11; }","tryCatchPattern":"try {\n  await runMemos({ since });\n} catch (err) {\n  if (err.name === 'ArgumentError' && err.message.includes('--since')) {\n    since = Math.floor(Date.now() / 1000); // or recompute from date\n  } else { throw err; }\n}","preventionTips":["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."],"tags":["cli","argument-validation","timestamp"],"backgroundTag":"invalid-timestamp-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}