{"id":"aa575cadac370acd","repo":"vitest-dev/vitest","slug":"provider-this-provider-name-does-not-support-co","errorCode":null,"errorMessage":"Provider ${this.provider.name} does not support command \"${name}\".","messagePattern":"Provider (.+?) does not support command \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser/src/node/project.ts","lineNumber":89,"sourceCode":"      throw new Error(\n        `Invalid command name \"${name}\". Only alphanumeric characters, $ and _ are allowed.`,\n      )\n    }\n    this.commands[name] = cb\n  }\n\n  public triggerCommand = (<K extends keyof BrowserCommand>(\n    name: K,\n    context: BrowserCommandContext,\n    ...args: Parameters<BrowserCommands[K]>\n  ): ReturnType<BrowserCommands[K]> => {\n    if (name in this.commands) {\n      return this.commands[name](context, ...args)\n    }\n    if (name in this.parent.commands) {\n      return this.parent.commands[name](context, ...args)\n    }\n    throw new Error(`Provider ${this.provider.name} does not support command \"${name}\".`)\n  }) as any\n\n  wrapSerializedConfig(): SerializedConfig {\n    const config = wrapConfig(this.project.serializedConfig)\n    config.env ??= {}\n    config.env.VITEST_BROWSER_DEBUG = process.env.VITEST_BROWSER_DEBUG || ''\n    return config\n  }\n\n  async initBrowserProvider(project: TestProject): Promise<void> {\n    if (this.provider) {\n      return\n    }\n    this.provider = await getBrowserProvider(project.config.browser, project)\n    if (this.provider.initScripts) {\n      this.parent.initScripts = this.provider.initScripts\n      // make sure the script can be imported\n      const allow = this.parent.vite.config.server.fs.allow","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/browser/src/node/project.ts#L71-L107","documentation":"`ProjectBrowser.triggerCommand` looks up the command first in the project's own command registry, then in the parent's registry. If neither contains it, the command is unsupported by the configured provider and the call is rejected with the provider name in the message.","triggerScenarios":"Triggering a command name that was never registered — typo, a command from a different provider (e.g. a Playwright-only command under WebDriverIO), or calling a builtin before it's registered.","commonSituations":"Typos in command names; using a provider-specific command (`__vitest_takeScreenshot` is provider-internal) under the wrong provider; calling a command after the project browser has been torn down.","solutions":["Check the command name spelling and case.","Confirm the command is registered — `project.browser.commands` (project) or `parent.commands` (builtin/global).","Switch to a provider that implements the command, or implement it yourself via `registerCommand`.","Ensure you're triggering the command from a browser test (a node-only project has no provider)."],"exampleFix":"// before\nawait context.triggerCommand('screenshot')\n\n// after — register or use the correct name\nawait context.triggerCommand('__vitest_takeScreenshot', name, opts)","handlingStrategy":"validation","validationCode":"function isCommandRegistered(\n  name: string,\n  projectBrowser: { commands: Record<string, unknown> },\n  parent: { commands: Record<string, unknown> },\n): boolean {\n  return name in projectBrowser.commands || name in parent.commands\n}","typeGuard":null,"tryCatchPattern":"try {\n  await context.triggerCommand(name, ...args)\n} catch (err) {\n  if (err instanceof Error && /does not support command/.test(err.message)) {\n    // typo, wrong provider, or never registered\n  }\n  throw err\n}","preventionTips":["Double-check command-name spelling and case.","Confirm the active provider implements the command (some are provider-specific).","Register custom commands before tests run via the browser config."],"tags":["browser-command","provider","validation"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}