{"record":{"id":"1da85ead7cebd54e","repo":"jackwener/OpenCLI","slug":"flomo-memos-since-must-be-a-safe-integer-unix-ti","errorCode":null,"errorMessage":"flomo memos --since must be a safe integer Unix timestamp in seconds","messagePattern":"flomo memos --since must be a safe integer Unix timestamp in seconds","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/flomo/memos.js","lineNumber":46,"sourceCode":"  }\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}\n\nfunction buildSignedUrl(limit, since, slug) {\n  const params = {\n    limit: String(limit),","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/flomo/memos.js#L28-L64","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","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."],"exampleFix":"// before\nflomo memos --since 1704067200000000000  # nanoseconds\n// after\nflomo memos --since 1704067200","handlingStrategy":"validation","validationCode":"if (!Number.isSafeInteger(Number(since)) || String(since).length > 11) {\n  throw new Error('since too large; expected unix seconds (10 digits)');\n}","typeGuard":"function isSafeUnixSeconds(v) { const n = Number(v); return Number.isSafeInteger(n) && n >= 0 && n <= Number.MAX_SAFE_INTEGER; }","tryCatchPattern":"try {\n  await runMemos({ since });\n} catch (err) {\n  if (err.name === 'ArgumentError' && err.message.includes('safe integer')) {\n    since = Math.floor(Number(since) / 1000); // likely ms or ns input\n  } else { throw err; }\n}","preventionTips":["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."],"tags":["cli","argument-validation","integer-overflow"],"backgroundTag":"invalid-timestamp-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}