mastra-ai/mastra · error · Error

Screencast not supported by this provider

Error message

Screencast not supported by this provider

What it means

startScreencast is another capability stub on the base MastraBrowser. Providers that can stream frames (e.g. via CDP Page.startScreencast) override it; the default always throws. Like connectToExternalCdp, screencast is per-provider opt-in.

Source

Thrown at packages/core/src/browser/browser.ts:1354

  }

  /**
   * Get the browser scope mode.
   * @returns The scope from threadManager or config, defaults to 'shared'
   */
  getScope(): BrowserScope {
    return this.threadManager?.getScope() ?? this.config.scope ?? 'shared';
  }

  // ---------------------------------------------------------------------------
  // Screencast (optional - for Studio live view)
  // ---------------------------------------------------------------------------

  /**
   * Start screencast streaming. Override in subclass if supported.
   */
  async startScreencast(_options?: ScreencastOptions): Promise<ScreencastStream> {
    throw new Error('Screencast not supported by this provider');
  }

  /**
   * Check if a thread has an existing browser session.
   * Used by startScreencastIfBrowserActive to prevent showing another thread's page.
   *
   * If threadManager is set, delegates to it. Otherwise returns true (no isolation).
   * Subclasses can override for custom behavior.
   *
   * @returns true if session exists or thread isolation is not used
   */
  hasThreadSession(threadId: string): boolean {
    if (!this.threadManager) {
      // No thread manager - all threads share the same session
      return true;
    }

    const scope = this.threadManager.getScope();

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Switch to a provider that overrides startScreencast (e.g. the CDP-capable provider).
  2. Gate the feature at runtime on provider capability before calling.
  3. Implement screencast in a custom provider subclass.
  4. Use screenshots (captureScreenshot) as a lower-tech fallback.

Example fix

// before
const stream = await baseProvider.startScreencast({ threadId }); // throws
// after
if (providerSupportsScreencast(browser)) {
  const stream = await browser.startScreencast({ threadId });
}
Defensive patterns

Strategy: fallback

Validate before calling

if (browser.startScreencast === MastraBrowser.prototype.startScreencast) {
  console.warn('Screencast unavailable for provider', browser.provider);
  return null;
}

Type guard

function supportsScreencast(b: object): boolean {
  return b.startScreencast !== MastraBrowser.prototype.startScreencast;
}

Try / catch

let stream: ScreencastStream | null = null;
try {
  stream = await browser.startScreencast({ threadId });
} catch (err) {
  if (err instanceof Error && err.message === 'Screencast not supported by this provider') {
    stream = null; // degrade to periodic screenshots
  } else throw err;
}

Prevention

When it happens

Trigger: Calling browser.startScreencast(options) on a provider subclass that does not implement screencast streaming.

Common situations: Building a UI that live-previews agent browsing sessions but running against a provider that only supports launching/automation; switching providers without auditing feature parity.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/0b20c624cbe19146. Report an issue: GitHub.