{"record":{"id":"09b505abcae2221c","repo":"paperclipai/paperclip","slug":"invalid-ttl-days-value-opts-ttldays","errorCode":null,"errorMessage":"Invalid --ttl-days value: ${opts.ttlDays}","messagePattern":"Invalid --ttl-days value: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/token.ts","lineNumber":240,"sourceCode":"    if (!agent || agent.companyId !== companyId) throw new Error(`Agent not found: ${agentRef}`);\n    return agent;\n  }\n  const query = new URLSearchParams({ companyId });\n  const agent = await api.get<Agent>(`${apiPath`/api/agents/${trimmed}`}?${query.toString()}`);\n  if (!agent || agent.companyId !== companyId) throw new Error(`Agent not found: ${agentRef}`);\n  return agent;\n}\n\nfunction resolveBoardKeyExpiresAt(opts: BoardTokenOptions): Date | null | undefined {\n  if (opts.neverExpires) return null;\n  if (opts.expiresAt?.trim()) {\n    const date = new Date(opts.expiresAt.trim());\n    if (!Number.isFinite(date.getTime())) throw new Error(`Invalid --expires-at value: ${opts.expiresAt}`);\n    return date;\n  }\n  if (opts.ttlDays?.trim()) {\n    const days = Number(opts.ttlDays);\n    if (!Number.isFinite(days) || days <= 0) throw new Error(`Invalid --ttl-days value: ${opts.ttlDays}`);\n    return new Date(Date.now() + Math.floor(days * 24 * 60 * 60 * 1000));\n  }\n  return undefined;\n}\n","sourceCodeStart":222,"sourceCodeEnd":245,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/token.ts#L222-L245","documentation":"Thrown by resolveBoardKeyExpiresAt (token.ts:240) when --ttl-days is provided but Number(value) is NaN, Infinity, or <= 0. Guards against non-positive or unparseable TTL values being sent to the board key creation endpoint.","triggerScenarios":"Passing --ttl-days \"abc\", --ttl-days \"0\", --ttl-days \"-5\", or --ttl-days \"\". Number() coerces and the guard rejects anything that is not a finite positive numeric value.","commonSituations":"Passing an env var that expanded empty, a decimal like 1.5 (Number.isFinite passes but intent is days), or a stray unit suffix like \"7d\".","solutions":["Pass a positive integer number of days: --ttl-days 30.","Strip any unit suffix before passing.","For permanent keys, use --never-expires instead of a large TTL."],"exampleFix":"// before\n--ttl-days \"30d\"\n// after\n--ttl-days 30","handlingStrategy":"validation","validationCode":"function isValidTtlDays(value: string | undefined): boolean {\n  if (!value?.trim()) return false;\n  const n = Number(value);\n  return Number.isFinite(n) && n > 0;\n}\n\nif (opts.ttlDays && !isValidTtlDays(opts.ttlDays)) {\n  console.error(`--ttl-days \"${opts.ttlDays}\" must be a positive number.`);\n  process.exit(1);\n}","typeGuard":"function isPositiveNumber(value: string): boolean {\n  const n = Number(value);\n  return Number.isFinite(n) && n > 0;\n}","tryCatchPattern":null,"preventionTips":["Pass a plain positive integer for --ttl-days.","Strip unit suffixes (e.g. 'd') before passing.","Use --never-expires for permanent keys instead of a huge TTL."],"tags":["cli","argument-validation","ttl","board-keys"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}