{"record":{"id":"3289acac4e4a44ca","repo":"paperclipai/paperclip","slug":"invalid-integer-value-value-3289ac","errorCode":null,"errorMessage":"Invalid integer value: ${value}","messagePattern":"Invalid integer value: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/plugin.ts","lineNumber":950,"sourceCode":"            { json: ctx.json },\n          );\n        } catch (err) {\n          handleCommandError(err);\n        }\n      }),\n    { includeCompany: false },\n  );\n}\n\nfunction parseJson(value: string): unknown {\n  return JSON.parse(value) as unknown;\n}\n\nfunction parseOptionalInt(value: string | undefined): number | undefined {\n  if (value === undefined) return undefined;\n  const parsed = Number.parseInt(value, 10);\n  if (!Number.isFinite(parsed) || parsed < 0) {\n    throw new Error(`Invalid integer value: ${value}`);\n  }\n  return parsed;\n}\n\nasync function streamPluginBridge(\n  apiBase: string,\n  apiKey: string | undefined,\n  pluginId: string,\n  channel: string,\n  durationMs: number | undefined,\n): Promise<void> {\n  const controller = new AbortController();\n  const timer = durationMs === undefined ? null : setTimeout(() => controller.abort(), durationMs);\n  try {\n    const response = await fetch(buildApiUrl(\n      apiBase,\n      `/api/plugins/${encodeURIComponent(pluginId)}/bridge/stream/${encodeURIComponent(channel)}`,\n    ), {","sourceCodeStart":932,"sourceCodeEnd":968,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/plugin.ts#L932-L968","documentation":"parseOptionalInt (plugin.ts) parses a string option as base-10 integer and throws if the result is not finite or is negative. Used for plugin flags such as --duration-ms.","triggerScenarios":"Passing `--duration-ms abc`, `--duration-ms -1`, or a non-numeric/float value to a plugin command.","commonSituations":"Typo; passing seconds where ms is expected and including a sign; copy-pasted value with units like \"500ms\".","solutions":["Pass a non-negative integer in milliseconds: `--duration-ms 5000`.","Omit the flag to use the default (no timeout).","Strip units/whitespace before passing."],"exampleFix":"// before\npaperclipai plugin stream plugin_x event --duration-ms -1\n// after\npaperclipai plugin stream plugin_x event --duration-ms 5000","handlingStrategy":"validation","validationCode":"function parseOptionalInt(value?: string) {\n  if (value === undefined) return undefined;\n  const parsed = Number.parseInt(value, 10);\n  if (!Number.isFinite(parsed) || parsed < 0) throw new Error(`Invalid integer value: ${value}`);\n  return parsed;\n}","typeGuard":"const isNonNegIntString = (v: string) => /^\\d+$/.test(v.trim());","tryCatchPattern":null,"preventionTips":["Pass durations in whole milliseconds.","Use a CLI parser that casts and constrains numeric flags."],"tags":["cli","plugin","input-validation","parsing"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}