# 错误：未找到名为'deploy-prod'的上下文。请创建上下文或检查上下文名称。

- **ID:** `cicd/circleci-no-context`
- **领域:** cicd
- **类别:** config_error
- **错误码:** `CIRCLECI_CONTEXT_MISSING`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

CircleCI流水线引用了组织中不存在的上下文名称，通常是由于拼写错误、上下文被删除或权限不足无法访问该上下文。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| CircleCI Server 4.0 | active | — | — |
| CircleCI CLI 0.1.30000 | active | — | — |

## 解决方案

1. ```
   List all available contexts via CircleCI CLI: `circleci context list --org-id <org-id>`. If 'deploy-prod' is missing, create it: `circleci context create <org-name> deploy-prod` and add required environment variables via UI or CLI
   ```
2. ```
   Verify the context name in the CircleCI config file (.circleci/config.yml) matches exactly (case-sensitive) the context created in the CircleCI web UI under Organization Settings > Contexts
   ```

## 无效尝试

- **** — The pipeline will find the context but fail later because required secrets (e.g., AWS keys) are missing from the empty context (80% 失败率)
- **** — The 'default' context may not exist or may not contain the required environment variables, causing subsequent steps to fail with missing credentials (60% 失败率)
