Troubleshooting
Each section gives the symptom, the usual causes and the fix. Logs come from docker compose logs -f qirsh, or from your process manager (journalctl -u qirsh -f under systemd).
The server exits at boot with "Invalid configuration"
The configuration is checked at start and every problem is listed, one per line:
Invalid configuration:
- MERCHANT_ADDRESS: must be a valid TRON address (T...)
- WEBHOOK_SECRET: required (24+ chars) when WEBHOOK_URL is setFix each line. The common ones:
| Message | Fix |
|---|---|
must be a valid TRON address (T...) |
Copy the address again. The checksum is checked, so one wrong character fails |
API_SECRET_KEY: must be at least 24 characters |
openssl rand -hex 32 |
WEBHOOK_SECRET: required (24+ chars) when WEBHOOK_URL is set |
Set a secret, or remove WEBHOOK_URL |
MERCHANT_ADDRESS: required when API_SECRET_KEY is set |
Single-store mode needs both |
ADMIN_PASSWORD: set ADMIN_EMAIL and ADMIN_PASSWORD together |
Set both or neither. The password needs 12+ characters |
ALLOW_SIMULATION: cannot be enabled on mainnet |
Set ALLOW_SIMULATION=false, or use NETWORK=nile |
DEPOSIT_MODE: forwarder mode needs FEE_PAYER_PRIVATE_KEY (or _FILE) / needs FORWARDER_FACTORY_<NETWORK> |
Set up the fee wallet and factory first, or use DEPOSIT_MODE=amount |
FEE_PAYER_PRIVATE_KEY_FILE: set FEE_PAYER_PRIVATE_KEY or FEE_PAYER_PRIVATE_KEY_FILE, not both |
Remove one |
FEE_PAYER_PRIVATE_KEY: ... |
The key must be 64 hex characters. With _FILE, check the path and that the gateway's user can read it |
SWEEP_STRAY_MIN_AMOUNT: must be at least SWEEP_MIN_AMOUNT |
Raise it, or lower SWEEP_MIN_AMOUNT |
FEE_PAYER_PRIVATE_KEY_FILE_NILE: ... (or _MAINNET, _SHASTA) |
The per-network key file is missing, unreadable or not 64 hex characters |
FEE_COLLECTOR_ADDRESS: must not be the fee payer wallet ... (or the token contract, the forwarder factory, MERCHANT_ADDRESS) |
Use a separate wallet for fees whose key is not on the server. The same applies to FEE_COLLECTOR_ADDRESS_<NETWORK> |
SWEEP_FEE_DEFAULT: has more decimals than the token |
At most 6 decimals for USDT, for example 1.5 |
TRX_USDT_RATE: Invalid rate ... |
A positive decimal such as 0.28, or leave it empty |
The full list of variables is in Configuration.
/health returns 503
The chain watcher has been failing for more than 5 poll intervals (at least 2 minutes). Look at watcher.last_error in the response:
curl -s https://pay.example.com/health- HTTP 429 or "rate limit" from TronGrid: set
TRONGRID_API_KEY(free at https://www.trongrid.io). On mainnet this is nearly always the cause. - Network errors: the server cannot reach
api.trongrid.io(or the Nile/Shasta endpoints). Check DNS, the firewall and outbound HTTPS. - A custom
TRONGRID_API_URLthat is down or wrong.
Payments sent while the watcher was down are not lost. It keeps a cursor and catches up over the next polls (catching_up: true meanwhile).
A payment was not detected
Check, in this order:
- The network. The customer sent USDT on TRON (TRC-20), not on Ethereum or another chain, and on the same network as the project (Nile test USDT does not count on mainnet).
- The token. USDT, not TRX or another token.
- The address. Sent to
pay_addressof the invoice. - The amount (unique-amount mode). Exactly
amount_due, including all six decimals. Otherwise it appears under Transfers as unmatched. - The time. Sent before
expires_at. Later transfers are not settled automatically. - The watcher.
/healthis200, and the project's Live indicator is green.
Look the transaction up on Tronscan (https://tronscan.org, or https://nile.tronscan.org for Nile) to see what was actually sent.
The dashboard lists an unmatched transfer
A confirmed transfer to the project wallet matched no invoice. Usually the customer sent a rounded amount or paid late, or paid an invoice twice. Open Transfers, find it, and press Assign... to settle the right invoice with it, or refund the customer. Assigning an underpaid or out-of-window transfer asks for confirmation. The store receives invoice.paid with settled_manually: true and the real amount_paid.
If this happens a lot, your customers probably pay from exchanges. Consider forwarder mode (Concepts).
An invoice stays in "confirming"
The transfer is on-chain but not solidified yet. That normally takes about a minute. If it lasts much longer:
- Check
/health: the watcher may be failing or catching up. - Look the transaction up on Tronscan. A failed or reverted transaction never becomes final.
Webhooks don't arrive
Open the project's Webhooks tab. Each event shows its status, attempts and last result.
| Last result | Cause | Fix |
|---|---|---|
No webhook URL configured for this project |
No URL set | Set it in Settings, Webhook. Then press Retry now on failed events |
Webhook URL points to a private or local address |
The URL resolves to localhost or a private network, which dashboard projects may not use | Use a public URL or a tunnel. For local development only, the operator can set ALLOW_PRIVATE_WEBHOOKS=true |
HTTP 3xx |
Redirects are not followed | Use the final URL (often https:// instead of http://, or a trailing slash) |
HTTP 401 / 403 / 419 |
Your framework's auth or CSRF middleware blocked it | Exclude the webhook route from auth and CSRF |
HTTP 400 |
Usually your own signature check failed (see below) | |
HTTP 5xx |
Your handler threw | Check your store's logs |
The operation was aborted due to timeout |
Your handler took over 10 seconds | Answer quickly; do slow work in a background job |
fetch failed, DNS errors |
The gateway cannot reach your server | Check DNS, firewall and TLS certificate from the gateway host |
Use Send test event to try your endpoint without a payment.
My store says "invalid signature"
- The body was parsed first. The signature covers the raw bytes. If your framework parsed the JSON and you re-serialized it, the bytes differ. See Getting the raw body.
- Wrong secret. Each project has its own secret, and Rotate replaces it. Copy it again from Settings, Webhook.
- Clock skew. Timestamps more than 300 seconds off are rejected. Run NTP on both servers.
- Header parsing. The header is
t=<unix>,v1=<hex>. Split on the first=of each part.
Test your code against the worked example.
The API answers 401 unauthorized
- The
Authorizationheader must beBearer <key>, with one space. - The key was revoked, or belongs to another gateway or project. Keys are shown only once when created. Make a new one under Settings, API keys.
- The project is disabled. An admin can re-enable it.
- In single-store mode the key is
API_SECRET_KEYfrom the gateway's.env.
The API answers 409 order_conflict
The order_id already has an open invoice for a different amount, usually because the cart changed after checkout started. Either use a new order_id for the new total (for example ORDER-1001-2), or wait until the old invoice expires; after that the same order_id gets a new invoice at any amount.
The API answers 400 amount_too_small
Forwarder projects only. The amount is below SWEEP_MIN_AMOUNT (default 1 USDT), or the project's network fee is paid by the merchant and less than SWEEP_MIN_AMOUNT would be left after it. The message names the smallest amount, for example "Amount must be at least 2.5 USDT for this project (it includes a 1.5 USDT network fee)". Raise the order total, take small orders in a unique-amount project, or ask the operator to lower the fee or let the customer pay it.
The API answers 503 forwarder_unavailable
Forwarder projects only. The gateway cannot derive deposit addresses for this project right now:
- The project's factory is not verified on this server. After an upgrade from forwarder contracts v1 this is expected until a v2 factory is deployed (
deploy-factory --network <n> --force) andFORWARDER_FACTORY_<NETWORK>points at it. See Upgrading from forwarder contracts v1. - TronGrid was unreachable when the factory was checked. Retry in a minute.
- The fee collector is the project's wallet or the fee wallet. Fix
FEE_COLLECTOR_ADDRESSand restart.
The store should retry later and tell the operator if it persists.
The API answers 503 amount_slots_exhausted
Unique-amount mode: every unique amount near this price is held by an open invoice on the same wallet. This happens with many open invoices at the same price. Retry shortly. If it persists, shorten the invoice lifetime, raise UNIQUE_AMOUNT_SLOTS (default 9999), or use forwarder mode for that project.
Forwarder mode: the requirements are not green
The How customers pay card lists checks. Each failing one names its cause:
- Fee payer: no
FEE_PAYER_PRIVATE_KEYorFEE_PAYER_PRIVATE_KEY_FILEon the server. - Factory configured: no
FORWARDER_FACTORY_<NETWORK>for the project's network. - Factory verified: the factory failed on-chain verification, or TronGrid could not be reached to check it. See below.
- Fee wallet: the fee wallet has too little TRX on this network.
- Destination: the project wallet is not usable (for example it is the fee wallet, or a deposit address of this gateway), or on-chain and local address derivation disagree.
- Token: the token contract could not be read on this network.
- Fee collector: the collector is the fee wallet, a contract of this gateway or one of its deposit addresses. Set
FEE_COLLECTOR_ADDRESSto a separate wallet. With no collector this check passes and the project pays no fee.
Saving with a failing check answers 409 forwarder_requirements.
Forwarder mode: sweeps fail, wait or are held
Hover the Sweep badge for the error, or call GET /api/v1/invoices/{id}/sweeps. /health shows the counts under sweeper.
| What you see | Cause | Fix |
|---|---|---|
held |
The balance is below the automatic minimum (SWEEP_MIN_AMOUNT for a payment, SWEEP_STRAY_MIN_AMOUNT for partial, late or extra funds) |
Press Sweep now. Below SWEEP_MIN_AMOUNT an admin must force it |
held with "the balance does not exceed the network fee" |
The address still owes its network fee and holds no more than the fee. A sweep would take no fee, so the operator would pay TRX for nothing | Wait for more funds (the next larger balance pays the fee), or an admin forces it. Sweep now without force answers 409 below_minimum |
held with "belongs to the previous contract version" |
A v1 deposit address from before network fees (forwarder.version: 1) |
Flush it by hand through the v1 factory, see the contracts README. Sweep now answers 409 legacy_forwarder |
| "fee wallet ... needs about ..." | The fee wallet is low or empty | Send TRX to the fee wallet. Sweeps resume by themselves |
| "daily sweep budget reached" and a banner | SWEEP_PROJECT_DAILY_BUDGET_TRX was reached for this project |
Wait for the 24 h window, or raise the budget |
| Banner "No fee wallet key is configured" | No fee key on the server | Set FEE_PAYER_PRIVATE_KEY_FILE and restart |
failed with "fee exceeds" |
The estimate is above SWEEP_FEE_LIMIT_TRX |
Raise the limit carefully, or wait for lower energy prices |
failed with a broadcast error |
TronGrid refused the transaction | Check the message; retry with Sweep now or npm run admin -- sweep <invoice> |
While a sweep waits, the funds stay at the deposit address, which can only pay your wallet. The invoice is already paid if the payment was complete.
Sweep now answers 409 below_minimum
Without force, Sweep now refuses a balance below SWEEP_MIN_AMOUNT, and a balance that does not exceed the invoice's unpaid network fee. Either sweep would cost the fee wallet more TRX than it is worth. The funds are safe at the address, which can only pay the project wallet. An admin can force the sweep in the dashboard or with npm run admin -- sweep <invoice> --force. API keys cannot force (403 forbidden).
Sweep now or Recover answers 409 legacy_forwarder
The invoice's deposit address was created by a v1 factory, before network fees. This version signs no v1 transactions. Payments to the address are still detected and settled, and its funds can only go to the project wallet. Move them with the v1 factory's flush(destination, salt, token) on Tronscan, as described in the contracts README. Anyone can send that transaction; it pays the TRX itself.
Forwarder mode: factory verification failed
verify-factory or the startup check compares the on-chain code with contracts/artifacts/forwarders.json. It fails when:
- The address is wrong, or on another network than
--network. - The contract was built from different sources or settings. Only a factory built from this repo's committed artifact passes.
- TronGrid was unreachable. Retry, and set
TRONGRID_API_KEYon mainnet.
Never point FORWARDER_FACTORY_* at a factory that has not passed verification. The server refuses to derive addresses from it anyway.
Log warning: "The fee payer key signs for mainnet and nile"
One server has factories for mainnet and a testnet with the same fee key. TRON transactions carry no chain id, so a malicious testnet node could get signatures that are valid on mainnet and burn the fee wallet's mainnet TRX. Run testnets on a separate instance with its own fee key, or remove the testnet FORWARDER_FACTORY_* lines.
The Fee wallet tab shows no recommended fee
The recommendation needs at least one confirmed sweep on that network and a TRX price. Enter the price on the tab (what one TRX costs in USDT, for example 0.28) or set TRX_USDT_RATE. Without a fee collector the tab says sweeps are free; set FEE_COLLECTOR_ADDRESS and restart.
The dashboard says "Confirm your password to continue" (403 reauth_required)
The action needs a fresh password: wallet, network or deposit mode changes, disabling a project, rotating a webhook secret, revoking the last API key, and changing a user's role, access or password. Enter your password in the Confirm it's you dialog; you are not asked again for 5 minutes in that session. Signing out or changing your password ends the window. A script that calls the dashboard API must call POST /dashboard/api/me/reauth with the password first. Too many wrong attempts hit the limit of 10 a minute (HTTP 429). Every wrong password is recorded in the activity log.
Saving a project answers 409 wallet_is_fee_collector
The wallet you entered is the operator's fee collector (FEE_COLLECTOR_ADDRESS or FEE_COLLECTOR_ADDRESS_<NETWORK>). Fees and payments must go to different wallets. Use the store's own wallet.
Changing the wallet answers 400 confirmation_mismatch or 409 unchanged
confirmation_mismatch: the 4 characters you typed are not the last 4 characters of the new address. They are case sensitive.unchanged: the address is already the project's wallet.env_managed: the single-store project's wallet isMERCHANT_ADDRESS. Change it in the environment and restart.
A generated wallet shows a different address in my wallet app
The dashboard derives the wallet at m/44'/195'/0'/0/0, the path TronLink and Trust Wallet use for the first account. A wallet app that uses another path or another account index shows a different address. Import the private key from the downloaded file instead, or pick the first account. Check that the words are in the right order: a typo gives an invalid phrase or a different wallet. Never send funds to a wallet until the app shows the exact address the dashboard showed.
I can't sign in to the dashboard
- Lost password. On the server:
npm run admin -- reset-password you@example.com(in Docker:docker compose exec qirsh node dist/cli.js reset-password you@example.com). It prints a new password and signs the user out everywhere. - No admin yet. Set
ADMIN_EMAILandADMIN_PASSWORDand restart, or runnpm run admin -- create-admin you@example.com. - Sign-in seems to work, then you are signed out at once.
PUBLIC_URLstarts withhttps://, so the session cookie is markedSecure, but you opened the dashboard over plainhttp://. Use the HTTPS address, or setPUBLIC_URL=http://localhost:8080for local use. - "Rate limit exceeded" (HTTP 429). Sign-in allows 10 attempts per minute per IP. Behind a proxy without
TRUST_PROXY=true, every user shares the proxy's IP. SetTRUST_PROXY=truewhen (and only when) a proxy you control sits in front. - Disabled user. An admin can re-enable them under Admin, Users.
Docker: "unable to open database file" or permission denied
The container runs as the node user (uid 1000) and writes to /data. If you mount a host directory instead of the named volume, give it to that user:
sudo chown -R 1000:1000 ./dataThe same applies to a fee key file mounted into the container: chown 1000 secrets/fee_payer.key && chmod 600 secrets/fee_payer.key.
npm ci fails while building better-sqlite3
better-sqlite3 downloads a prebuilt binary for your platform and Node version. When none exists, it compiles from source and needs Python 3, make and a C++ compiler:
sudo apt-get install -y python3 make g++ # Debian, UbuntuUse Node 22 or later. After switching Node versions, run npm rebuild better-sqlite3. The Docker image already includes the build tools.