vercel/ai · error · LoadSettingError

${description} setting is missing. Pass it using the '${sett

Error message

${description} setting is missing. Pass it using the '${settingName}' parameter or the ${environmentVariableName} environment variable.

What it means

loadSetting found neither the named parameter nor the expected environment variable, so it throws LoadSettingError naming both. This is the standard 'required setting not configured' failure for string settings like region.

Source

Thrown at packages/provider-utils/src/load-setting.ts:45

  if (settingValue != null) {
    throw new LoadSettingError({
      message: `${description} setting must be a string.`,
    });
  }

  if (typeof process === 'undefined') {
    throw new LoadSettingError({
      message:
        `${description} setting is missing. ` +
        `Pass it using the '${settingName}' parameter. ` +
        `Environment variables are not supported in this environment.`,
    });
  }

  settingValue = process.env[environmentVariableName];

  if (settingValue == null) {
    throw new LoadSettingError({
      message:
        `${description} setting is missing. ` +
        `Pass it using the '${settingName}' parameter ` +
        `or the ${environmentVariableName} environment variable.`,
    });
  }

  if (typeof settingValue !== 'string') {
    throw new LoadSettingError({
      message:
        `${description} setting must be a string. ` +
        `The value of the ${environmentVariableName} environment variable is not a string.`,
    });
  }

  return settingValue;
}

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Set the indicated environment variable (e.g. export AWS_REGION=us-east-1) or add to .env
  2. Or pass the setting explicitly: createAmazonBedrock({ region: 'us-east-1' })
  3. Verify exact variable name/casing expected by the provider
  4. Add the value to your deployment platform's environment configuration

Example fix

// before
const bedrock = createAmazonBedrock();
// after
const bedrock = createAmazonBedrock({ region: process.env.AWS_REGION });
Defensive patterns

Strategy: validation

Validate before calling

const region = process.env.AWS_REGION;
if (!region) throw new Error('AWS_REGION is not set. Export it or pass createAmazonBedrock({ region }).');
const bedrock = createAmazonBedrock({ region });

Type guard

function hasSetting(value: unknown): value is string {
  return typeof value === 'string' && value.length > 0;
}

Try / catch

try {
  const bedrock = createAmazonBedrock();
} catch (error) {
  if (/setting is missing/.test(String(error.message))) {
    console.error('Set AWS_REGION (or pass { region }) before using the Bedrock provider');
    process.exit(1);
  }
  throw error;
}

Prevention

When it happens

Trigger: Creating a provider without the setting option while process.env[environmentVariableName] (e.g. AWS_REGION for Bedrock) is unset.

Common situations: Missing AWS_REGION/region config in local dev; CI missing the secret; .env not loaded; deploying a Bedrock provider without platform env vars configured.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/6f84aed7ec1441de. Report an issue: GitHub.