{"record":{"id":"cdbb99096eb889d9","repo":"vercel/ai","slug":"acp-resolved-environment-value-name-is-unavaila","errorCode":null,"errorMessage":"ACP resolved environment value ${name} is unavailable.","messagePattern":"ACP resolved environment value (.+?) is unavailable\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/acp-v1-harness.ts","lineNumber":841,"sourceCode":"      value.$source === 'gateway-api-key' ||\n      value.$source === 'gateway-authorization'\n    );\n  }\n  return Object.values(value).some(item =>\n    containsACPProviderCredential({ value: item }),\n  );\n}\n\nfunction requireResolvedEnvironmentValue({\n  environment,\n  name,\n}: {\n  environment: Readonly<Record<string, string>>;\n  name: string;\n}): string {\n  const value = environment[name];\n  if (value == null) {\n    throw new Error(`ACP resolved environment value ${name} is unavailable.`);\n  }\n  return value;\n}\n\nfunction resolveBridgePort({\n  sandboxSession,\n  override,\n  harnessId,\n}: {\n  sandboxSession: HarnessV1NetworkSandboxSession | SandboxSession;\n  override: number | undefined;\n  harnessId: string;\n}): number {\n  if (override !== undefined) return override;\n  if ('ports' in sandboxSession && sandboxSession.ports.length > 0) {\n    return sandboxSession.ports[0];\n  }\n  throw unsupported({","sourceCodeStart":823,"sourceCodeEnd":859,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/acp-v1-harness.ts#L823-L859","documentation":"requireResolvedEnvironmentValue is a lookup helper used by resolveProviderEnvironment: it fetches a named value from an already-resolved environment record and throws if it is null/undefined. Hitting this means an env var the provider configuration requires was expected to be present in the resolved environment but was not, so downstream provider setup cannot proceed.","triggerScenarios":"resolveProviderEnvironment resolving the environment map and then calling requireResolvedEnvironmentValue({ environment, name }) for a key (e.g. a provider API key or credential-brokered value) that is absent or explicitly undefined in the resolved record.","commonSituations":"A credentialEnv mapping references a variable that is not actually set in the process environment; brokering produced no value for the key; typos between the declared and actual env var names; running outside the environment (e.g. local vs sandbox) where the variable exists.","solutions":["Set the missing environment variable in the process environment before creating the harness.","Check credentialEnv/credentialBrokering configuration so the value is actually injected into the resolved environment.","Verify the variable name spelling matches between declaration and environment.","Log/inspect the resolved environment record to see which keys are actually present."],"exampleFix":"// before\n// env lacks ANTHROPIC_API_KEY; resolveProviderEnvironment throws\n// after\nexport ANTHROPIC_API_KEY=sk-...  # or add to credentialEnv so it is brokered in","handlingStrategy":"validation","validationCode":"function requireEnv(name: string): string {\n  const value = process.env[name];\n  if (value == null) throw new Error(`Missing required env var ${name}`);\n  return value;\n}\n// call for each expected key before createACP\nrequireEnv('ANTHROPIC_API_KEY');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["List all required env vars in one startup validation function.","Keep credentialEnv key names in sync with actual environment variables via shared constants.","Verify the execution environment (local/CI/sandbox) actually provides the brokered credentials."],"tags":["environment","missing-env-var","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}