{"record":{"id":"5b7a9ae5ca8895c9","repo":"microsoft/playwright","slug":"fps-must-be-a-positive-number-got-params-fps","errorCode":null,"errorMessage":"\"fps\" must be a positive number, got ${params.fps}","messagePattern":"\"fps\" must be a positive number, got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/dispatchers/pageDispatcher.ts","lineNumber":401,"sourceCode":"  }\n\n  async screencastSetOverlayVisible(params: channels.PageScreencastSetOverlayVisibleParams): Promise<channels.PageScreencastSetOverlayVisibleResult> {\n    await this._page.overlay.setVisible(params.visible);\n  }\n\n  async screencastShowActions(params: channels.PageScreencastShowActionsParams): Promise<channels.PageScreencastShowActionsResult> {\n    this._page.screencast.showActions({ duration: params.duration, position: params.position, fontSize: params.fontSize, cursor: params.cursor, style: params.style });\n  }\n\n  async screencastHideActions(): Promise<channels.PageScreencastHideActionsResult> {\n    this._page.screencast.hideActions();\n  }\n\n  async screencastStart(params: channels.PageScreencastStartParams, progress?: Progress): Promise<channels.PageScreencastStartResult> {\n    if (this._screencastClient || this._videoRecorder)\n      throw new Error('Screencast is already running');\n    if (params.fps !== undefined && params.fps <= 0)\n      throw new Error(`\"fps\" must be a positive number, got ${params.fps}`);\n\n    if (params.sendFrames) {\n      this._screencastClient = {\n        onFrame: async (frame: ScreencastFrame) => {\n          const frameId = ++this._screencastFrameId;\n          const promise = new ManualPromise<void>();\n          this._screencastFrameAcks.set(frameId, promise);\n          this._dispatchEvent('screencastFrame', { frameId, data: frame.buffer, timestamp: frame.frameSwapWallTime, viewportWidth: frame.viewportWidth, viewportHeight: frame.viewportHeight });\n          await promise;\n        },\n        gracefulClose: () => this._clearScreencastFrameAcks(),\n        dispose: () => this._clearScreencastFrameAcks(),\n        size: params.size,\n        quality: params.quality,\n      };\n      this._page.screencast.addClient(this._screencastClient);\n    }\n","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/microsoft/playwright/blob/f1d33b5029be8bbc1095fe88e559117fa3a6243b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts#L383-L419","documentation":"The PageScreencastStart dispatcher validates the requested frames-per-second before starting a page screencast session. A non-positive fps (0 or negative) cannot drive frame capture, so the server rejects the request before any screencast client or video recorder is attached.","triggerScenarios":"Calling the screencast start API (Page.screencastStart protocol / page screencast entry point) with params.fps set to 0 or a negative number.","commonSituations":"Feeding fps from a computed value that resolves to 0, translating config where 0 meant 'default', or wiring a custom client to the internal screencast API with unvalidated user input.","solutions":["Pass a positive fps value (e.g. 25) when starting the screencast.","Omit fps from params to use the server default.","Clamp/validate user- or config-supplied fps before issuing the call.","If a screencast/video recording is already running, stop it first (that produces the related 'Screencast is already running' error)."],"exampleFix":"// before\nawait page.screencastStart({ fps: 0 });\n// after\nawait page.screencastStart({ fps: 25 });","handlingStrategy":"validation","validationCode":"if (fps !== undefined && (!(typeof fps === 'number') || fps <= 0))\n  throw new Error(`fps must be a positive number, got ${fps}`); // validate before calling screencastStart","typeGuard":"function isValidScreencastFps(fps: unknown): fps is number {\n  return typeof fps === 'number' && Number.isFinite(fps) && fps > 0;\n}","tryCatchPattern":"try {\n  await page.screencastStart({ fps });\n} catch (e) {\n  if ((e as Error).message.includes('\"fps\" must be a positive number')) {\n    await page.screencastStart({}); // retry with default fps\n  } else throw e;\n}","preventionTips":["Clamp user/config-supplied fps: Math.max(1, value) or omit when unset.","Omit fps to use the server default.","Ensure only one screencast/video recording runs per page at a time.","Validate numeric inputs at the boundary before issuing protocol calls."],"tags":["screencast","video","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"f1d33b5029be8bbc1095fe88e559117fa3a6243b","analyzedAt":"2026-09-21T21:58:31.278Z","contentChangedAt":"2026-09-21T21:58:31.278Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}