microsoft/playwright · error · Error

Invalid data URL: ${url.slice(0, 80)}

Error message

Invalid data URL: ${url.slice(0, 80)}

What it means

Error "Invalid data URL: ${url.slice(0, 80)}" thrown in microsoft/playwright.

Source

Thrown at packages/playwright-core/src/server/webkit/webview/wvPage.ts:519

    const loaderIdPromise = new Promise<string>(resolve => {
      this._pendingMainFrameLoaderResolvers.set(frame._id, resolve);
    });
    try {
      this._session.sendMayFail('Runtime.evaluate', {
        expression: `window.location.href = ${JSON.stringify(url)}`,
        returnByValue: true,
      } as any);
      const loaderId = await loaderIdPromise;
      return { newDocumentId: loaderId };
    } finally {
      this._pendingMainFrameLoaderResolvers.delete(frame._id);
    }
  }

  private async _navigateToDataUrl(frame: frames.Frame, url: string): Promise<frames.GotoResult> {
    const match = /^data:([^,]*),([\s\S]*)$/.exec(url);
    if (!match)
      throw new Error(`Invalid data URL: ${url.slice(0, 80)}`);
    const meta = match[1];
    const data = match[2];
    const content = /;base64$/i.test(meta)
      ? Buffer.from(data, 'base64').toString('utf8')
      : decodeURIComponent(data);
    const result = await this._navigateMainFrame(frame, 'about:blank');
    await this._session.sendMayFail('Runtime.evaluate', {
      expression: `(function() { document.open(); document.write(${JSON.stringify(content)}); document.close(); })()`,
    } as any);
    return result;
  }

  _onConsoleMessage(event: Protocol.Console.messageAddedPayload) {
    // Note: do no introduce await in this function, otherwise we lose the ordering.
    // For example, frame.setContent relies on this.
    const { type, level, text, parameters, url, line: lineNumber, column: columnNumber, source } = event.message;

    if (level === 'debug' && parameters && parameters.length >= 2 && parameters[0].type === 'string') {

View on GitHub (pinned to c8fc3bf8d3)

When it happens

Trigger: Thrown at packages/playwright-core/src/server/webkit/webview/wvPage.ts:519 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/2f311a50f2d637d5. Report an issue: GitHub.