{"record":{"id":"4dc22cab7c41ffbb","repo":"mastra-ai/mastra","slug":"unsupported-browser-provider-provider","errorCode":null,"errorMessage":"Unsupported browser provider: ${provider}","messagePattern":"Unsupported browser provider: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/sdk/src/onboarding/settings.ts","lineNumber":1362,"sourceCode":"        middleware: createCodexMiddleware(),\n      } as any;\n    }\n\n    return cdpUrl\n      ? new StagehandBrowser({ ...launchConfig, cdpUrl, scope: 'shared', ...stagehandOpts })\n      : new StagehandBrowser({ ...launchConfig, ...stagehandOpts });\n  } else if (provider === 'agent-browser') {\n    const { AgentBrowser } = await import('@mastra/agent-browser');\n    const agentBrowserOpts = {\n      storageState: agentBrowser?.storageState,\n      recording: browserRecordingOptions(),\n    };\n    return cdpUrl\n      ? new AgentBrowser({ ...launchConfig, cdpUrl, scope: 'shared', ...agentBrowserOpts })\n      : new AgentBrowser({ ...launchConfig, ...agentBrowserOpts, scope });\n  }\n\n  throw new Error(`Unsupported browser provider: ${provider}`);\n}\n","sourceCodeStart":1344,"sourceCodeEnd":1364,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/sdk/src/onboarding/settings.ts#L1344-L1364","documentation":"The browser onboarding settings factory only supports the providers 'stagehand' and 'agent-browser'. If settings.provider is any other string, the factory throws `Unsupported browser provider: ${provider}`. This is a configuration validation error at the end of the provider-selection switch.","triggerScenarios":"Calling the browser factory with settings.provider set to anything other than 'stagehand' or 'agent-browser' — e.g. 'playwright', 'chrome', 'puppeteer', an empty string, or a misspelled/renamed provider in the settings file.","commonSituations":"Editing the onboarding/settings store by hand with an old or invented provider name; a config migration or version change renaming providers; copying settings from another tool that uses different provider identifiers.","solutions":["Set settings.provider to 'stagehand' or 'agent-browser'.","Check for typos/renames (e.g. 'agent-browser' not 'agentbrowser' or 'agent_browser') in the stored settings.","If migrating from an older version, migrate the stored provider value to a supported name before invoking the factory.","Validate provider with an allowlist check before calling the factory and surface a friendly settings error."],"exampleFix":"// before\nconst settings = { provider: 'playwright', headless: true, ... };\nconst browser = await createBrowser(settings); // throws\n// after\nconst settings = { provider: 'agent-browser', headless: true, ... };\nconst browser = await createBrowser(settings);","handlingStrategy":"validation","validationCode":"const SUPPORTED_PROVIDERS = ['stagehand', 'agent-browser'] as const;\ntype Provider = typeof SUPPORTED_PROVIDERS[number];\nfunction assertValidProvider(p: string): asserts p is Provider {\n  if (!SUPPORTED_PROVIDERS.includes(p as Provider)) {\n    throw new Error(`provider must be one of ${SUPPORTED_PROVIDERS.join(', ')}, got '${p}'`);\n  }\n}\nassertValidProvider(settings.provider);","typeGuard":"function isSupportedProvider(p: string): p is 'stagehand' | 'agent-browser' {\n  return p === 'stagehand' || p === 'agent-browser';\n}","tryCatchPattern":"try {\n  return await createBrowser(settings);\n} catch (e) {\n  if (e.message.startsWith('Unsupported browser provider:')) {\n    const fallback = { ...settings, provider: 'agent-browser' as const };\n    return createBrowser(fallback); // or re-prompt the user for settings\n  }\n  throw e;\n}","preventionTips":["Constrain settings.provider to the literal union type 'stagehand' | 'agent-browser' in the settings schema.","Validate stored settings with an allowlist on load and auto-migrate legacy provider names.","Offer a settings picker instead of free-text provider entry in onboarding UI."],"tags":["browser","configuration","unsupported-provider"],"backgroundTag":"unsupported-provider-config","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}