Repository: browserbase/stagehand
File: packages/core/lib/v3/types/public/sdkErrors.ts (TypeScript)

Code before:
    currentEnvironment: string,
    requiredEnvironment: string,
    feature: string,
  ) {
    super(
      `You seem to be setting the current environment to ${currentEnvironment}.` +
        `Ensure the environment is set to ${requiredEnvironment} if you want to use ${feature}.`,
    );
  }
}

export class MissingEnvironmentVariableError extends StagehandError {
  constructor(missingEnvironmentVariable: string, feature: string) {
    super(
      `${missingEnvironmentVariable} is required to use ${feature}.` +
        `Please set ${missingEnvironmentVariable} in your environment.`,
    );
  }
}

export class UnsupportedModelError extends StagehandError {
  constructor(supportedModels: string[], feature?: string) {
    const modelList = supportedModels.join(", ");
    const deprecationNote =
      `\n\nNote: The legacy model format (e.g., "gpt-4o") is deprecated. ` +
      `Please use the provider/model format instead (e.g., "openai/gpt-4o", "anthropic/claude-3-5-sonnet-latest").`;

    super(
      feature
        ? `${feature} requires one of the following models: ${modelList}${deprecationNote}`
        : `Please use one of the supported models: ${modelList}${deprecationNote}`,
    );
  }
}

export class UnsupportedModelProviderError extends StagehandError {
  constructor(supportedProviders: string[], feature?: string) {
    super(
      feature
        ? `${feature} requires one of the following model providers: ${supportedProviders}`
        : `please use one of the supported model providers: ${supportedProviders}`,
    );
  }
}

export class UnsupportedAISDKModelProviderError extends StagehandError {
  constructor(provider: string, supportedProviders: string[]) {
    super(
      `${provider} is not currently supported for aiSDK. please use one of the supported model providers: ${supportedProviders}`,
    );
  }

Review comment (suggestion):
```suggestion
      `Please use the provider/model format instead (e.g., "openai/gpt-5", "anthropic/claude-sonnet-4-5").`;
```

Code after:
    currentEnvironment: string,
    requiredEnvironment: string,
    feature: string,
  ) {
    super(
      `You seem to be setting the current environment to ${currentEnvironment}.` +
        `Ensure the environment is set to ${requiredEnvironment} if you want to use ${feature}.`,
    );
  }
}

export class MissingEnvironmentVariableError extends StagehandError {
  constructor(missingEnvironmentVariable: string, feature: string) {
    super(
      `${missingEnvironmentVariable} is required to use ${feature}.` +
        `Please set ${missingEnvironmentVariable} in your environment.`,
    );
  }
}

export class UnsupportedModelError extends StagehandError {
  constructor(supportedModels: string[], feature?: string) {
    const modelList = supportedModels.join(", ");
    const deprecationNote =
      `\n\nNote: The legacy model format (e.g., "gpt-4o") is deprecated. ` +
      `Please use the provider/model format instead (e.g., "openai/gpt-5", "anthropic/claude-sonnet-4").`;

    super(
      feature
        ? `${feature} requires one of the following models: ${modelList}${deprecationNote}`
        : `Please use one of the supported models: ${modelList}${deprecationNote}`,
    );
  }
}

export class UnsupportedModelProviderError extends StagehandError {
  constructor(supportedProviders: string[], feature?: string) {
    super(
      feature
        ? `${feature} requires one of the following model providers: ${supportedProviders}`
        : `please use one of the supported model providers: ${supportedProviders}`,
    );
  }
}

export class UnsupportedAISDKModelProviderError extends StagehandError {
  constructor(provider: string, supportedProviders: string[]) {
    super(
      `${provider} is not currently supported for aiSDK. please use one of the supported model providers: ${supportedProviders}`,
    );
  }