{"record":{"id":"a423640465dc3989","repo":"heygen-com/hyperframes","slug":"remote-debugging-port-must-be-an-integer-between","errorCode":null,"errorMessage":"--remote-debugging-port must be an integer between 1 and 65535","messagePattern":"--remote-debugging-port must be an integer between 1 and 65535","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils/openBrowser.ts","lineNumber":20,"sourceCode":"\nexport interface OpenBrowserOptions {\n  browserPath?: string;\n  userDataDir?: string;\n  remoteDebuggingPort?: number;\n  /**\n   * Launch the browser with --disable-gpu. For hosts where hardware\n   * acceleration crashes the graphics driver (wild report: auto-opened\n   * preview triggered NVIDIA Xid 32 resets on NixOS). Only effective with\n   * `browserPath` — the `open`-package fallback launches the system default\n   * browser with no way to pass Chromium flags.\n   */\n  disableGpu?: boolean;\n}\n\nexport function parseRemoteDebuggingPort(value: string | undefined): number | undefined {\n  if (value === undefined || value === \"\") return undefined;\n  if (!/^\\d+$/.test(value)) {\n    throw new Error(\"--remote-debugging-port must be an integer between 1 and 65535\");\n  }\n  const port = Number(value);\n  if (port < 1 || port > 65535) {\n    throw new Error(\"--remote-debugging-port must be an integer between 1 and 65535\");\n  }\n  return port;\n}\n\nexport interface RemoteDebuggingPortDeps {\n  browserPath?: string;\n  userDataDir?: string;\n  remoteDebuggingPort?: string;\n}\n\n/**\n * Returns an error message if --remote-debugging-port is set without its required\n * dependencies (--browser-path and --user-data-dir), or null if everything is OK.\n */","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/utils/openBrowser.ts#L2-L38","documentation":"parseRemoteDebuggingPort rejects the raw string value because it fails the /^\\d+$/ regex — i.e. it contains non-digit characters: a negative sign, decimal point, hex, letters, spaces, or a +. The function expects a pure digit string representing an integer port. This is the format-validation branch (the range branch at line 24 is a separate error).","triggerScenarios":"Passing --remote-debugging-port with a non-integer value: '9222abc', '0x23f3', '22.5', '-1', '9222 ' (trailing space), 'port', or an empty-ish non-string. The value is a string from the CLI/argv before it reaches this parser.","commonSituations":"User typed a hex port; a shell variable expanded with extra characters; a copy-paste from a URL like chrome://inspect?port=9222 that carried extra chars; a config file providing a YAML number that got coerced oddly.","solutions":["Pass a plain positive integer string, e.g. --remote-debugging-port=9222.","Strip any non-digit characters from the value before passing it in.","If the value comes from a config, ensure the config serializes it as an integer, not a hex/float."],"exampleFix":"# before\nhyperframes preview --remote-debugging-port=0x23f3\n# after\nhyperframes preview --remote-debugging-port=9222","handlingStrategy":"validation","validationCode":"function isValidPortInput(v: unknown): v is string {\n  return typeof v === 'string' && /^\\d+$/.test(v);\n}\n\nconst raw = config.remoteDebuggingPort;\nif (raw !== undefined && raw !== '' && !isValidPortInput(raw)) {\n  throw new Error('remoteDebuggingPort must be a digit-only string');\n}","typeGuard":"function isDigitOnlyPortString(v: unknown): v is string {\n  return typeof v === 'string' && /^\\d+$/.test(v) && Number(v) >= 1 && Number(v) <= 65535;\n}","tryCatchPattern":"try {\n  const port = parseRemoteDebuggingPort(rawValue);\n} catch (err) {\n  if (err instanceof Error && /must be an integer/.test(err.message)) {\n    console.error('Pass --remote-debugging-port as a plain integer (e.g. 9222).');\n  } else throw err;\n}","preventionTips":["Normalize config values to plain integer strings before they reach this parser.","Validate user-supplied ports with /^\\d+$/ in your CLI layer and reject early with a friendlier message."],"tags":["cli","validation","browser","port","parsing"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}