# 錯誤代碼說明-傳遞參數驗證類

本頁列出 PrivAI 自行檢查參數組合時回傳的錯誤代碼。欄位型別、必填、enum 值等基本格式驗證失敗時，回傳的是不帶 `error_code` 的 422 `{"detail": [...]}`，請見 [例外狀況處理](https://privstation-docs.apmic.ai/latest/privai-400/例外狀況處理.md)。

| Error Code | HTTP Status | Scenario | Error Message | Inherent Payload |
| --- | --- | --- | --- | --- |
| `VAL_001` | 422 | 列表 API 同時提供 `before` 與 `after` | Cannot provide both 'before' and 'after' simultaneously. |  |
| `VAL_002` | 404 | 列表 API 的 `before` 或 `after` 所指定的 ID 不存在 | ID not found from 'before' or 'after': {cursor_id}. |  |
| `VAL_003` | 422 | Chat Completions 同時提供 `prompt` 與 `prompt_id` | Cannot provide both 'prompt' and 'prompt_id' simultaneously. |  |
| `VAL_004` | 422 | Chat Completions 的 `messages` 順序不符合規則（不含 `system` 訊息）：`user` 與 `assistant` 必須交替，且必須以 `user` 開頭、以 `user` 結尾 | Messages sequence must alternate between 'user' and 'assistant' roles, starting with 'user' and end with 'user'. |  |
| `VAL_005` | 400 | Chat Completions 同時提供 `fileset_id` 與 `fileset_ids` | Cannot provide both 'fileset_id' and 'fileset_ids' simultaneously. |  |

各錯誤代碼可能出現在哪些端點，請見 [錯誤代碼說明-API Endpoint 特定錯誤情境](https://privstation-docs.apmic.ai/latest/privai-400/錯誤代碼說明-api-endpoint-特定錯誤情境.md)。
