Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
エージェントと開発者向け l402-kit のセマンティックエラーコード。
{ "error": "ERROR_CODE", "code": 402, "cause": "Human-readable explanation", "action": "recommended_action", "retry": false }
{ "error": "PAYMENT_FAILED", "code": 402, "cause": "Insufficient balance in wallet", "action": "increase_budget", "retry": false }
budgetSats
{ "error": "TOKEN_EXPIRED", "code": 402, "cause": "Macaroon expiry timestamp exceeded", "action": "request_new_invoice", "retry": true }
{ "error": "BUDGET_EXCEEDED", "code": 402, "cause": "Session budget of {n} sats exhausted", "action": "stop_or_increase_budget", "retry": false }
{ "error": "INVALID_MACAROON", "code": 402, "cause": "Macaroon is not valid base64 JSON", "action": "request_new_invoice", "retry": true }
{ "error": "TOKEN_ALREADY_USED", "code": 401, "cause": "Preimage was already presented — replay attack blocked", "action": "do_not_retry", "retry": false }
{ "error": "NODE_UNREACHABLE", "code": 503, "cause": "Lightning node did not respond within timeout", "action": "retry_with_backoff", "retry": true }
{ "error": "INVOICE_EXPIRED", "code": 402, "cause": "BOLT11 invoice expired before payment was submitted", "action": "request_new_invoice", "retry": true }
{ "error": "WRONG_PREIMAGE", "code": 402, "cause": "SHA256(preimage) does not match paymentHash in macaroon", "action": "check_wallet_payment", "retry": false }
import { l402 } from "l402-kit/agent"; try { const res = await client.fetch("https://api.example.com/data"); } catch (err: any) { if (err.error === "BUDGET_EXCEEDED") { // 停止してユーザーに報告する } else if (err.retry === true) { // 短い遅延の後に安全に再試行できる await sleep(1000); const res = await client.fetch("https://api.example.com/data"); } }