> ## Documentation Index
> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Approvals 疑難排解

> 修正未出現或未通過的 Claude Approvals 檢查、Approvals 拒絕的政策檔案，以及未給出答案的分類器

[Claude Approvals](https://code.claude.com/docs/zh-TW/approvals.md) 是 GitHub pull request 上的一項檢查，會回報還有誰必須核准。當檢查未出現或未通過、Approvals 拒絕政策檔案，或分類器未給出答案時，請從這裡開始。

如果您 pull request 上的 **Claude Approvals** 檢查標題未涵蓋於此，請參閱[查看您的核准狀態與後續步驟](https://code.claude.com/docs/zh-TW/approvals-pull-requests.md#find-your-approval-status-and-what-to-do-next)。

## 未出現 Claude Approvals 檢查

當 [Claude Approvals](https://code.claude.com/docs/zh-TW/approvals.md) 無法執行時，它可能完全不會發佈任何內容。

### 檢查您的 pull request 與政策檔案

先從您可以自行檢查的原因開始：

| 原因 | 處理方式 |
| :- | :- |
| pull request 是草稿 | 將其標記為可供審查 |
| [政策檔案](https://code.claude.com/docs/zh-TW/approvals-policy.md#where-to-put-a-policy-file)不在 Approvals 查找的位置 | 將其放在儲存庫根目錄的 `.claude/approvals.yml`，位於預設分支上，並包含 `version: 1` |
| 檔案合併後沒有任何後續動作 | 推送一個提交到該 pull request |
| 政策處於觀察模式，且 pull request 的目標分支不是預設分支 | 預期不會出現檢查，除非該 pull request 變更了政策檔案或分類器檔案 |
| 政策已強制執行，且沒有任何規則涵蓋 pull request 所變更的任何檔案 | 請參閱[沒有規則涵蓋檔案時會發生什麼](https://code.claude.com/docs/zh-TW/approvals-policy.md#how-rules-combine-into-one-verdict) |

### Claude 留下了留言但沒有 Approvals 檢查

找出 Claude 留言中的文字，然後採取其旁邊的步驟：

| 留言內容 | 處理方式 |
| :- | :- |
| Approvals "did not run on this change" | 依照留言的指示操作。其中一個原因是 pull request 將檔案移入或移出政策規則所涵蓋的路徑。請將該移動拆成兩個 pull request：一個以新名稱新增檔案，另一個移除舊檔案 |
| "More than one Claude organization is connected to this GitHub account" | 請應執行 Approvals 的 Claude 組織的 Owner 在 [**Organization settings > Claude Ship**](https://claude.ai/admin-settings/claude-ship) 上，點選儲存庫所屬 GitHub 組織旁的 **Connect**。然後推送一個提交 |
| "Claude Approvals can't start in this repository yet" | 告知 Owner 該組織沒有可用的用量點數 |

### 請 Owner 檢查您的 Claude 組織

請 Owner 針對您的 Claude 組織檢查以下各項：

| 檢查項目 | 位置 |
| :- | :- |
| 組織是否符合資格 | [可用性](https://code.claude.com/docs/zh-TW/approvals.md#availability) |
| [Claude GitHub App](https://github.com/apps/claude) 是否能存取該儲存庫且已連結 | [**Organization settings > Git providers**](https://claude.ai/admin-settings/source-control) |
| 此處的 Approvals 是否已關閉 | [**Organization settings > Claude Ship**](https://claude.ai/admin-settings/claude-ship) 上的 **Approvals** 欄與 **Approve** 列 |

## 解決審查討論串後 Approvals 仍未通過

檢查您政策的 [`findings`](https://code.claude.com/docs/zh-TW/approvals-policy#findings) 清單是否列出了您。

如果您的解決不算數，請推送修正，或請清單上的某人解決該討論串。

## Approvals 已通過但 GitHub 仍阻擋合併

閱讀 GitHub 合併區塊中列出的規則。如果它要求審查，表示 GitHub 的分支規則要求一項政策未要求的審查，因此請作者以外的人在 GitHub 審查中核准。關於 GitHub 的計算方式，請參閱[必要審查與 CODEOWNERS](https://code.claude.com/docs/zh-TW/approvals-github-rules.md#required-reviews-and-codeowners)。

## 修正 Approvals 拒絕的政策檔案

在下表中找出 **Claude Approvals** 檢查的標題：

| 標題 | 有問題的副本 | 訊息 | 處理方式 |
| :- | :- | :- | :- |
| **This change breaks a policy file** | pull request 本身的副本 | 檢查摘要中的 **Policy files in this change** | 在此 pull request 中修正 |
| **Default branch policy file cannot be used**、**Default branch policy file must be version 1**、**Default branch policy file is too large** | 預設分支上的根政策檔案 | 檢查摘要 | 在從此儲存庫分支建立的新 pull request 中修正。其 **Policy files in this change** 會顯示新副本是否能載入。無論處於觀察模式或強制執行，該 pull request 的檢查都會失敗，如同每個 pull request 的檢查一樣。若該分支要求此檢查，請可以略過分支規則的人來合併它 |
| **A policy file cannot be used** | 預設分支上某個目錄的政策檔案 | 檢查摘要 | 以修正根政策檔案的方式修正 |

修正合併後，請等待五分鐘，然後在每個檢查尚未更新的開啟中 pull request 上留言 [`@claude approvals rerun`](https://code.claude.com/docs/zh-TW/approvals-pull-requests#comment-commands-for-approvals)。對於來自 fork 的 pull request，請[先閱讀變更並加上最新提交的完整 SHA](https://code.claude.com/docs/zh-TW/approvals-pull-requests.md#pull-requests-from-forks-and-outside-contributors)。

### 政策檔案拒絕訊息

一項拒絕就會使整個政策檔案無法使用，而警告不會導致任何失敗。

在這裡找出您訊息的開頭：

| 訊息 | 修正方式 |
| :- | :- |
| "no key of this name is read at this place" | 對照[頂層鍵](https://code.claude.com/docs/zh-TW/approvals-policy.md#top-level-keys)與[規則鍵](https://code.claude.com/docs/zh-TW/approvals-policy.md#rule-keys)，檢查鍵的拼寫與其層級 |
| "this names no fact and no usable classifier" | 對照 [facts](https://code.claude.com/docs/zh-TW/approvals-policy.md#if) 檢查名稱。對於 `repo/<name>`，請檢查位於政策檔案旁或其上層目錄中的 `.claude/classifiers/<name>/def.yml` 是否能載入 |
| "a condition has no NOT" | 改寫為相反的運算子 |
| "no local has this name" | 在此檔案或其上層的政策檔案中定義該 local。撰寫登入名稱或團隊時不要加 `@` |
| "this is not YAML" | 在訊息指出的行附近，尋找未閉合的引號或括號，或是 tab 字元。請使用空格縮排 |

## 分類器未給出答案或其定義遭拒絕

若要查看每次[分類器](https://code.claude.com/docs/zh-TW/approvals-classifiers.md)執行的狀態以及缺少答案的原因，請在 Claude 於 pull request 上的留言中開啟 **Classifier results**。如果某次執行達到其預算，請拆分 pull request，或提高低於其[上限](https://code.claude.com/docs/zh-TW/approvals-classifiers.md#budget)的 `time` 或 `cost`。

接著在這裡找出 **Claude Approvals** 檢查的標題：

| 標題 | 處理方式 |
| :- | :- |
| **A classifier definition is not valid**，或在政策檔案指名該分類器時出現的 **This change breaks a policy file** | 在此 pull request 中修正定義。拒絕訊息位於 **Policy files in this change** 下 |
| **A classifier's definition cannot be used** | 在預設分支上修正定義。變更該定義的 pull request 會顯示其遭拒絕的原因 |
| **Cannot evaluate: classifier outside advisory** | 當政策檔案位於子目錄中時，某些自訂分類器[只能放在 `advisory` 下](https://code.claude.com/docs/zh-TW/approvals-policy#policy-files-in-subdirectories)。請將分類器移到該處 |
| **repo/change\_risk reached its run limit**（顯示您的分類器名稱），或 **A classifier reached its run limit** | 推送一項會改變差異的變更。或留言 `@claude approvals rerun` 以再執行一次，但這可能會捨棄每個分類器的結果，包括已通過的結果 |

## 相關資源

* [在 pull request 上使用 Claude Approvals](https://code.claude.com/docs/zh-TW/approvals-pull-requests.md)：檢查標題與留言命令
* [設定 Claude Approvals](https://code.claude.com/docs/zh-TW/approvals-setup.md)：需求、入門政策與必要檢查
* [Claude Approvals 政策檔案參考](https://code.claude.com/docs/zh-TW/approvals-policy.md)：政策檔案的鍵
