## 事象
`~/.copilot/config.json` に `hooks.Notification` を以下のように設定する。
```json
{
"hooks": {
"Notification": [
{
"type": "command",
"bash": "cat >> /tmp/copilot_noti.log",
"timeoutSec": 5
}
]
}
}
```
[[GitHub Copilot CLI]]を起動した直後に設定が以下のように変化する。
```json
"hooks": {
"notification": [
{
"type": "command",
"bash": "cat >> /tmp/copilot_noti.log",
"timeoutSec": 5,
"_vsCodeCompat": "Notification"
}
]
},
```
そして、次に[[GitHub Copilot CLI]]を起動すると以下のエラーになる。
```error
✗ Failed to start MCP Servers: Error: Failed to read configuration from /Users/tadashi-aikawa/.copilot/config.json: [
{
"received": "Notification",
"code": "invalid_enum_value",
"options": [
"SessionStart",
"SessionEnd",
"UserPromptSubmit",
"PreToolUse",
"PostToolUse",
"PostToolUseFailure",
"ErrorOccurred",
"Stop",
"SubagentStop",
"PreCompact"
],
"path": [
"hooks",
"notification",
0,
"_vsCodeCompat"
],
"message": "Invalid enum value. Expected 'SessionStart' | 'SessionEnd' | 'UserPromptSubmit' | 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' |
'ErrorOccurred' | 'Stop' | 'SubagentStop' | 'PreCompact', received 'Notification'"
}
]
```
### 環境
| 対象 | バージョン |
| ---------------------- | ------ |
| [[macOS]] | 15.7.4 |
| [[GitHub Copilot CLI]] | 1.0.24 |
## 原因
`~/.copilot/config.json` に設定するプロパティが違うから。
## 解決方法
`hooks.Notification` ではなく `hooks.notification` を設定する。
```diff
"hooks": {
- "Notification": [
+ "notification": [
{
"type": "command",
"bash": "cat >> /tmp/copilot_noti.log",
"timeoutSec": 5
}
]
},
```
## 参考
### 🤖AIの調査結果
原因は GitHub Copilot CLI 側の不整合です。あなたの環境の `copilot` は `1.0.24` で、`Notification` を `notification` に正規化する処理は入っている一方、そのとき自動で付ける `_vsCodeCompat: "Notification"` を後段のバリデータが受け付けません。結果として、1回目の起動で設定が書き換わり、2回目の起動でその書き換え後設定を自分で読めずに落ちています。根拠は app.js の `gRt` と `hRt` 周辺で、`Notification -> notification` の変換はあるのに、`_vsCodeCompat` の enum には `Notification` が含まれていないことです。`notification` フック自体は changelog.json で `1.0.18` 追加扱いです。
回避策は `config.json` では最初から lowerCamelCase を使い、`_vsCodeCompat` を入れないことです。つまり次の形にしてください。
```json
{
"hooks": {
"notification": [
{
"type": "command",
"bash": "cat >> /tmp/copilot_noti.log",
"timeoutSec": 5
}
]
}
}
```
すでに書き換わったファイルは、`_vsCodeCompat` を削除すれば起動できるはずです。`Notification` は現状の CLI では安全ではありません。公式ドキュメント側も hook 名は `sessionStart` などの lowerCamelCase 表記です: https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/use-hooks
必要なら次に、再現最小構成つきで upstream issue に貼る報告文をそのまま作ります。