paperclipai/paperclip · error · Error

Invalid --ttl-days value

Error message

Invalid --ttl-days value: ${opts.ttlDays}

What it means

resolveBoardKeyExpiresAt parsed --ttl-days as a number and it was not a positive integer, so the expiry offset is invalid.

Solutions

  1. Pass a positive integer number of days for --ttl-days.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/client/token.ts:240 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/09b505abcae2221c. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/client/token.ts:240

    if (!agent || agent.companyId !== companyId) throw new Error(`Agent not found: ${agentRef}`);
    return agent;
  }
  const query = new URLSearchParams({ companyId });
  const agent = await api.get<Agent>(`${apiPath`/api/agents/${trimmed}`}?${query.toString()}`);
  if (!agent || agent.companyId !== companyId) throw new Error(`Agent not found: ${agentRef}`);
  return agent;
}

function resolveBoardKeyExpiresAt(opts: BoardTokenOptions): Date | null | undefined {
  if (opts.neverExpires) return null;
  if (opts.expiresAt?.trim()) {
    const date = new Date(opts.expiresAt.trim());
    if (!Number.isFinite(date.getTime())) throw new Error(`Invalid --expires-at value: ${opts.expiresAt}`);
    return date;
  }
  if (opts.ttlDays?.trim()) {
    const days = Number(opts.ttlDays);
    if (!Number.isFinite(days) || days <= 0) throw new Error(`Invalid --ttl-days value: ${opts.ttlDays}`);
    return new Date(Date.now() + Math.floor(days * 24 * 60 * 60 * 1000));
  }
  return undefined;
}

View on GitHub (pinned to 120ae5428f)