# 錯誤代碼

| 代碼 | 意思 | 修正提示（hint） | 重試 |
| --- | --- | --- | --- |
| `AMOUNT_OUT_OF_RANGE` | 總額超出允許的範圍。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `APPROVAL_NOT_FOUND` | 找不到這張核可單，或它不是這把權杖送的。 | Find the correct number or id with the matching _search tool. |  |
| `APPROVAL_OUTCOME_UNKNOWN` | 核可之後開始執行，系統出錯或太久沒有結果，不確定這件事有沒有做成。 | This action may already have been done: the system failed after it started. Check <target> with <get tool> first; only if it was not done, call the tool again with a new idempotency_key (it needs approval again). Do not retry with the original idempotency_key. |  |
| `BILL_AMOUNT_EXCEEDS_UNBILLED` | 請款金額超過訂單還沒請款的金額（params.unbilled）。 | Call order_get and read unbilled_amount (params.unbilled): the amount cannot be more than it; 0 means the order is already fully billed. |  |
| `BILL_HAS_EINVOICE` | 請款單開了還有效的統一發票（params.number），要先作廢發票。 | Void the e-invoice params.number with einvoice_void first, then try again. |  |
| `BILL_HAS_PAYMENTS` | 請款單已經有付款，要先作廢付款才能取消。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `BILL_NOT_FOUND` | 找不到這張請款單。 | Find the correct number or id with the matching _search tool. |  |
| `BILL_STATE_INVALID` | 請款單現在的狀態（params.status）不能做這件事。 | Check the current status and allowed_actions with the matching _get tool. |  |
| `BUYER_TAX_ID_REQUIRED` | 應稅、單價不含稅的訂單或報價單，買方要有統一編號。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `CONCURRENT_MODIFICATION` | 資料在讀取之後被改過，帶的 version 已經不是最新的。 | Read it again with the matching _get tool, then resend with the new version. |  |
| `CONFIRMATION_CODE_EXPIRED` | 確認碼超過 10 分鐘，要重新試算。 | The confirmation code is valid for 10 minutes. Run dry_run again, show the user the result and ask again before sending. |  |
| `CONFIRMATION_CODE_INVALID` | 確認碼不是這把權杖對這個動作試算給的，或寄的內容跟試算時不一樣。 | Use the confirmation_code from a dry run of this tool by this token with exactly the same parameters. If the parameters changed, run dry_run again and ask the user again. |  |
| `CONFIRMATION_CODE_REQUIRED` | 寄信之前要先試算、問過使用者，帶試算給的確認碼才能寄。 | Call this tool with dry_run: true first, show the user the bills, amounts and recipients, and ask whether to send. If the user agrees, call again with the same parameters and the confirmation_code from the dry run. |  |
| `CONFIRMATION_CODE_USED` | 這個確認碼已經用過，信已經排進去了。 | These emails were already queued with this confirmation code. Check email_log_search before sending again; to send again, run dry_run and ask the user. |  |
| `CONFIRMATION_DATA_CHANGED` | 試算之後資料變了，這次一封都沒寄，要重新試算、再問使用者。 | Something changed after the dry run (see params.bills). Run dry_run again, show the user what changed and ask again before sending. |  |
| `CURRENCY_NOT_ENABLED` | 工作區沒有啟用這個幣別（啟用的幣別在 params.enabled）。 | Choose one of (params.enabled), or ask a member to enable the currency in Settings → Currencies. |  |
| `CUSTOMER_EMAIL_MISSING` | 請款單的買方沒有 Email，寄不出去。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `CUSTOMER_NOT_FOUND` | 找不到這位客戶。 | Use customer_search to find the customer, or leave out `customer_id` and fill in the customer and buyer details yourself. |  |
| `CUSTOMER_NUMBER_TAKEN` | 客戶編號已經有別的客戶在用。 | Use customer_search to find the customer that already has this number, or choose another number. |  |
| `EINVOICE_ACTION_IN_PROGRESS` | 這張統一發票的上一個動作還在等加值服務中心回覆，還不能向加值服務中心查詢（params.queryableAt 之後可以查）。 | The last action on this e-invoice is still waiting for the provider. Call einvoice_sync again after params.queryableAt. | 可以重試 |
| `EINVOICE_ALLOWANCE_EXCEEDS` | 折讓金額超過還能折讓的金額（params.allowable）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_ALREADY_ISSUED` | 這張請款單已經開過統一發票（params.number）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_BUYER_EMAIL_MASKED` | 送來的買受人 Email 是遮蔽過的，要帶完整的 Email。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_BUYER_EMAIL_REQUIRED` | 這種開法要買受人的 Email。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_CARRIER_INVALID` | 載具號碼的格式不對（params.carrierType）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_CREDENTIALS_INVALID` | 電子發票加值服務中心不接受這組商店代號、HashKey、HashIV，設定沒有存。 | The provider rejected this merchant ID, hash_key or hash_iv. Ask the user to check them, and that they are for the chosen environment (TEST or PRODUCTION), then retry with a new idempotency_key. The setting was not saved. |  |
| `EINVOICE_CURRENCY_NOT_SUPPORTED` | 統一發票只能用新台幣開，這張請款單的幣別不行（params.currency）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_DONATION_CODE_INVALID` | 捐贈碼的格式不對。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_HAS_ALLOWANCES` | 統一發票有還有效的折讓，要先作廢折讓。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_NOT_CONFIGURED` | 工作區沒有啟用中的電子發票設定。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_NOT_FOUND` | 找不到這張統一發票或折讓。 | Find the correct number or id with the matching _search tool. |  |
| `EINVOICE_NOT_SENT` | 系統沒有在時限內送出，加值服務中心沒有收到這次的開立、作廢或折讓。 | The request was not sent to the provider, so nothing happened there. Issue it again with a new idempotency_key if it is still needed. |  |
| `EINVOICE_PROVIDER_REJECTED` | 電子發票加值服務中心拒絕這次的開立、作廢或折讓（原因在 params.message）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_SETTING_BUILT_IN` | 這是內建的電子發票測試設定，只能改名稱。 | This is the built-in test setting: only its name (and payment methods) can change. Ask a workspace member to add the user's own setting on the website. |  |
| `EINVOICE_SETTING_IN_USE` | 電子發票設定啟用中，或開過發票，不能刪。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EINVOICE_SETTING_NOT_FOUND` | 找不到這個電子發票設定。 | Find the correct number or id with the matching _search tool. |  |
| `EINVOICE_STATE_INVALID` | 統一發票或折讓現在的狀態（params.status）不能做這件事。 | Check the current status and allowed_actions with the matching _get tool. |  |
| `EMAIL_ALREADY_QUEUED` | 這張請款單已經有一封請款信在排隊。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `EMAIL_LOG_NOT_FOUND` | 找不到這筆寄信紀錄。 | Find the correct number or id with the matching _search tool. |  |
| `EMAIL_NOT_RESENDABLE` | 只有寄送失敗（FAILED）的請款信能重寄。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `FORBIDDEN` | 這把權杖沒有這個動作要的授權項目（params.action）。 | This token does not have `params.action`. Ask a member of the workspace to issue a token that includes it; do not try to get around it with another tool. |  |
| `GATEWAY_CREDENTIALS_INVALID` | 金流不接受這組商店代號、HashKey、HashIV，設定沒有存。 | The provider rejected this merchant ID, hash_key or hash_iv. Ask the user to check them, and that they are for the chosen environment (TEST or PRODUCTION), then retry with a new idempotency_key. The setting was not saved. |  |
| `GATEWAY_PAYMENT_METHODS_REQUIRED` | 金流設定至少要勾一種付款方式。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `GATEWAY_PAYMENT_NOT_VOIDABLE` | 經金流收到的付款不能作廢。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `GATEWAY_QUERY_FAILED` | 向金流查詢時連不上或回應看不懂，晚一點可以再查。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. | 可以重試 |
| `GATEWAY_SETTING_BUILT_IN` | 這是內建的金流測試設定，只能改名稱和付款方式。 | This is the built-in test setting: only its name (and payment methods) can change. Ask a workspace member to add the user's own setting on the website. |  |
| `GATEWAY_SETTING_IN_USE` | 金流設定啟用中，或已經有交易，不能刪。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `GATEWAY_SETTING_NOT_FOUND` | 找不到這個金流設定。 | Find the correct number or id with the matching _search tool. |  |
| `GATEWAY_TRANSACTION_NOT_FOUND` | 找不到這筆金流交易，或這筆不是重複或多付的款項。 | Find the correct number or id with the matching _search tool. |  |
| `GATEWAY_TRANSACTION_STATE_INVALID` | 金流交易現在的狀態（params.status）不能做這件事。 | Check the current status and allowed_actions with the matching _get tool. |  |
| `IDEMPOTENCY_CONFLICT` | 這個 idempotency_key 已經用在參數不一樣的請求。 | This idempotency_key was already used for another request. To repeat the same request, resend it with its original parameters; for a different request, use a new key. |  |
| `IDEMPOTENCY_IN_PROGRESS` | 用同一個 idempotency_key 送的第一個請求還在處理。 | Wait params.retryAfterSeconds seconds, then resend with the same idempotency_key. | 可以重試 |
| `INTERNAL_ERROR` | astermesh 內部出了沒預期到的錯誤。 | Retry later with the same idempotency_key; if it keeps failing, tell the user. | 可以重試 |
| `INVALID_DATE_RANGE` | 日期區間的開始晚於結束。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `ONLINE_PAYMENT_NOT_AVAILABLE` | 工作區沒有啟用中的金流，不能勾線上付款。 | Set online_payment to false, or ask a member to activate a payment gateway. |  |
| `ORDER_NOT_FOUND` | 找不到這張訂單。 | Find the correct number or id with the matching _search tool. |  |
| `ORDER_STATE_INVALID` | 訂單現在的狀態（params.status）不能做這件事。 | Check the current status and allowed_actions with the matching _get tool. |  |
| `PAID_DATE_IN_FUTURE` | 付款日期不能晚於今天。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `PAYMENT_ALREADY_VOIDED` | 這筆付款已經作廢。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `PAYMENT_EXCEEDS_OUTSTANDING` | 付款金額超過請款單還欠的金額（params.outstanding）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `PAYMENT_HAS_REFUNDS` | 這筆付款之後有退款，要先作廢退款。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `PAYMENT_NOT_FOUND` | 找不到這筆付款。 | Find the correct number or id with the matching _search tool. |  |
| `PLAN_QUOTA_EXCEEDED` | 用平台信箱寄信的額度不夠：本月免費的用完了，加購的也不夠（本月免費額度歸零的日期在 params.resetsOn，加購的剩幾封在 params.credits_remaining）。 | The email quota is used up: this month's free emails are used and there are not enough purchased email credits. Try again on or after params.resetsOn, ask an owner to buy email credits in Settings → Plan & billing, or switch the workspace to its own SMTP. Do not retry now. |  |
| `PRODUCT_NOT_FOUND` | 找不到這個商品。 | Use product_search to find the product. |  |
| `PRODUCT_REF_TAKEN` | 商品的品號已經有別的商品在用。 | Use product_search to find the product that already has this item code, or choose another item code. |  |
| `QUOTE_NOT_FOUND` | 找不到這張報價單。 | Find the correct number or id with the matching _search tool. |  |
| `QUOTE_STATE_INVALID` | 報價單現在的狀態（params.status）不能做這件事。 | Check the current status and allowed_actions with the matching _get tool. |  |
| `RATE_LIMITED` | 這把權杖這一分鐘呼叫太多次（每分鐘 120 次）。 | Wait params.retryAfterSeconds seconds, then resend with the same idempotency_key. | 可以重試 |
| `REFUND_ALREADY_VOIDED` | 這筆退款已經作廢。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `REFUND_DATE_IN_FUTURE` | 退款日期不能晚於今天。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `REFUND_EXCEEDS_REFUNDABLE` | 退款金額超過還能退的金額（params.refundable）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `REFUND_NOT_FOUND` | 找不到這筆退款。 | Find the correct number or id with the matching _search tool. |  |
| `TOKEN_EXPIRED` | 權杖已經過了到期日。 | Ask a member of the workspace to issue a new token in Settings → Agent tokens. |  |
| `TOKEN_INVALID` | 沒帶權杖、格式不對，或系統裡沒有這把權杖。 | Ask a member of the workspace to issue a new token in Settings → Agent tokens. |  |
| `TOKEN_REVOKED` | 權杖已經撤銷，或發權杖的人已經離開工作區。 | Ask a member of the workspace to issue a new token in Settings → Agent tokens. |  |
| `TOO_MANY_BILLS` | 一次帶的請款單太多（上限在 params.max）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `TOO_MANY_ITEMS` | 清單的項目太多（field；上限在 params.max）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `TOOL_NOT_FOUND` | 沒有這個名稱的 tool。 | Call tools/list to see the tools this token can use. |  |
| `VALUE_INVALID` | 參數的格式或型別不對（field）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `VALUE_NOT_ALLOWED` | 參數的值不在允許的範圍或選項裡（field；範圍、選項在 params）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `VALUE_REQUIRED` | 少了必填的參數（field）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
| `VALUE_TOO_LONG` | 參數的文字太長（field；上限在 params）。 | Fix the parameter named in `field` according to `params`, then retry with a new idempotency_key. |  |
