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. Environment variables are not supported in this environment. What it means
loadSetting could not resolve a required setting: no value was passed via the named parameter and `process` is undefined, so environment variables cannot be read. It throws LoadSettingError instructing you to pass the setting explicitly.
Source
Thrown at packages/provider-utils/src/load-setting.ts:34
description,
}: {
settingValue: string | undefined;
environmentVariableName: string;
settingName: string;
description: string;
}): string {
if (typeof settingValue === 'string') {
return settingValue;
}
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.`,
});
}
View on GitHub (pinned to 69428b1f8b)
Solutions
- Pass the setting explicitly: createAmazonBedrock({ region: env.AWS_REGION })
- Forward platform env bindings into the factory call in edge/serverless code
- Enable Node.js runtime compatibility if available
- Move provider creation into a server-side module where env access exists
Example fix
// before (edge runtime)
const bedrock = createAmazonBedrock();
// after
const bedrock = createAmazonBedrock({ region: env.AWS_REGION }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof process === 'undefined' && !env.AWS_REGION) {
throw new Error('Pass region explicitly: env vars are unavailable in this runtime');
}
const bedrock = createAmazonBedrock({ region: env.AWS_REGION }); Type guard
function canUseProcessEnv(): boolean {
return typeof process !== 'undefined' && typeof process.env === 'object';
} Try / catch
try {
const bedrock = createAmazonBedrock();
} catch (error) {
if (/setting is missing/.test(String(error.message))) {
throw new Error('Set AWS_REGION or pass createAmazonBedrock({ region }) in this runtime');
}
throw error;
} Prevention
- Forward platform env bindings explicitly in edge/serverless code
- Create providers only in server-side modules where configuration is available
- Fail fast at boot if required settings are missing in non-Node runtimes
When it happens
Trigger: Constructing a provider that requires a setting (e.g. createAmazonBedrock() without region) in a runtime without the Node process global (Edge, Workers, browser).
Common situations: Edge deployments where AMZN_REGION-style env vars are unavailable; browser code instantiating a server-oriented provider; workers lacking Node compat.
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
- ${description} API key is missing. Pass it using the '${apiK
- ${description} setting is missing. Pass it using the '${sett
- ACP resolved environment value ${name} is unavailable.
- ACP runtime environment key ${JSON.stringify(key)} cannot be
- ACP runtime environment key ${JSON.stringify(key)} cannot be
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/858cc05c98ff80a6.
Report an issue: GitHub.