Skip to content

Commit c40580e

Browse files
Add error code reference and cross-link troubleshooting guide (#136)
- Add reference/error-codes.mdx: normative flat tables for Soroban contract errors (#N codes), SDK error messages, CLI error codes, and Soroban RPC/indexer errors. Each row has a stable anchor for Discord and support citations. - Add cross-links from every relevant section in guides/stellar-troubleshooting.mdx back to the matching table row. - Add reference/error-codes to the Reference nav group in docs.json. - Include auto-generation note describing a generate:error-codes script pattern mirroring scripts/generate-stellar-reference.ts.
1 parent d0d48db commit c40580e

3 files changed

Lines changed: 171 additions & 9 deletions

File tree

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
"pages": [
9999
"reference/audits",
100100
"reference/auditor-guide",
101+
"reference/error-codes",
101102
"reference/security-disclosure",
102103
"reference/sep-compatibility",
103104
"reference/stellar-networks",

guides/stellar-troubleshooting.mdx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ _Last Verified: June 24, 2026_
88

99
When building on Stellar or Soroban with Wraith, you might encounter opaque errors. This guide catalogs the most common errors, what they mean, and how to fix them.
1010

11+
> **Looking for a linkable table?** The [Error Code Reference](/reference/error-codes) has normative flat tables for every Soroban contract error (`#N` codes), SDK error messages, CLI error codes, and Soroban RPC indexer errors — all in one place. Each row has a stable anchor you can paste into support tickets or Discord.
12+
1113
## Account & Balance Errors
1214

1315
### 1. `tx_bad_seq`
@@ -106,7 +108,8 @@ try {
106108
### 7. `Soroban RPC: retention window exceeded`
107109
**Meaning**: The requested historical data is no longer available on the RPC node.
108110
**Cause**: Querying events or transactions that occurred before the node's configured retention window.
109-
**Fix**: Use an archiver node or data indexer like Hubble to fetch historical data.
111+
**Fix**: Use an archiver node or data indexer like Hubble to fetch historical data.
112+
**Reference**: [Error Code Reference → `retention_window_exceeded`](/reference/error-codes#soroban-rpc--indexer-errors)
110113
```typescript
111114
// Instead of querying Soroban RPC for old events, query an indexer API
112115
const response = await fetch(`https://indexer.example.com/events?contract=${contractId}`);
@@ -188,7 +191,8 @@ await server.submitTransaction(tx);
188191
### 13. `Derived address matches recipient`
189192
**Meaning**: The calculated stealth address is identical to the recipient's public key.
190193
**Cause**: The recipient's scan key or spend key wasn't properly configured, or entropy generation failed.
191-
**Fix**: Ensure cryptographically secure random entropy is used when deriving the ephemeral key.
194+
**Fix**: Ensure cryptographically secure random entropy is used when deriving the ephemeral key.
195+
**Reference**: [Error Code Reference → `Point at infinity`](/reference/error-codes#sdk-errors--stellar-chain-primitives)
192196
```typescript
193197
import { randomBytes } from 'crypto';
194198
import { deriveStealthAddress } from '@wraith/stealth';
@@ -203,7 +207,8 @@ if (stealthInfo.address === recipientMeta.publicKey) {
203207
### 14. `Zero-balance scan returning matches`
204208
**Meaning**: The stealth scan function is finding addresses that belong to the user, but they have no balance.
205209
**Cause**: Dusting attacks, or previous stealth payments were fully spent but the ledger still shows the account.
206-
**Fix**: Filter scan results to only include accounts with a balance greater than 0 (or base reserve).
210+
**Fix**: Filter scan results to only include accounts with a balance greater than 0 (or base reserve).
211+
**Reference**: [Error Code Reference → SDK Stellar Primitives](/reference/error-codes#sdk-errors--stellar-chain-primitives)
207212
```typescript
208213
const matches = await stealthScanner.scan(startLedger, endLedger);
209214
const activeMatches = await Promise.all(
@@ -219,7 +224,8 @@ const validMatches = activeMatches.filter(m => m !== null);
219224
### 15. `Name resolution null` (Federation)
220225
**Meaning**: A Stellar Federation address (e.g., `user*wraith.com`) could not be resolved to an account ID.
221226
**Cause**: The federation server is down, or the user does not exist on that domain.
222-
**Fix**: Fall back to manual address entry or retry the federation lookup.
227+
**Fix**: Fall back to manual address entry or retry the federation lookup.
228+
**Reference**: [Error Code Reference → `wraith-names` #5 `NameNotFound`](/reference/error-codes#wraith-names)
223229
```typescript
224230
try {
225231
const record = await StellarSdk.FederationServer.resolve('alice*example.com');
@@ -233,7 +239,8 @@ try {
233239
### 16. `Stealth payload too large for memo`
234240
**Meaning**: The stealth ephemeral public key or metadata exceeds the 32-byte limit of a Stellar `Memo.hash`.
235241
**Cause**: Attempting to attach uncompressed keys or extra data in the memo field.
236-
**Fix**: Use compressed public keys or store extra metadata in Soroban contract state/events instead.
242+
**Fix**: Use compressed public keys or store extra metadata in Soroban contract state/events instead.
243+
**Reference**: [Error Code Reference → SDK Stellar Primitives](/reference/error-codes#sdk-errors--stellar-chain-primitives)
237244
```typescript
238245
// Ensure the ephemeral key is 32 bytes
239246
const ephemeralKeyBuffer = getCompressedKey(ephemeralPublicKey);
@@ -248,7 +255,8 @@ const tx = new StellarSdk.TransactionBuilder(account, { fee: "100" })
248255
### 17. `HostError: Error(Contract, #)` / Contract Trapped
249256
**Meaning**: The smart contract executed a `panic!` or returned a specific error code.
250257
**Cause**: A contract assertion failed (e.g., unauthorized caller, arithmetic overflow).
251-
**Fix**: Check the Soroban CLI or RPC logs for the exact error code and match it to the contract's source code.
258+
**Fix**: Check the Soroban CLI or RPC logs for the exact error code and match it to the contract's source code.
259+
**Reference**: [Error Code Reference → stealth-registry](/reference/error-codes#stealth-registry) · [stealth-sender](/reference/error-codes#stealth-sender) · [wraith-names](/reference/error-codes#wraith-names)
252260
```rust
253261
// In your Soroban contract:
254262
#[contracterror]
@@ -264,7 +272,8 @@ pub enum Error {
264272
### 18. `op_no_trust` / Missing Trustline
265273
**Meaning**: The Soroban contract attempted to send a Classic asset (like USDC) to an account that doesn't trust it.
266274
**Cause**: The recipient has not established a trustline for the asset being sent by the contract.
267-
**Fix**: Have the recipient submit a `ChangeTrust` operation for the asset before invoking the contract.
275+
**Fix**: Have the recipient submit a `ChangeTrust` operation for the asset before invoking the contract.
276+
**Reference**: [Error Code Reference → stealth-sender #4 `ZeroAmount`](/reference/error-codes#stealth-sender) (related token-transfer failures)
268277
```typescript
269278
// Recipient must submit this transaction first
270279
const tx = new StellarSdk.TransactionBuilder(recipientAccount, { fee: "100" })
@@ -277,7 +286,8 @@ const tx = new StellarSdk.TransactionBuilder(recipientAccount, { fee: "100" })
277286
### 19. `Expired auth` / `auth_invalid`
278287
**Meaning**: The Soroban authorization payload is invalid or has expired.
279288
**Cause**: A time-bound authorization signature (`SorobanAuthorizationEntry`) expired before the transaction was submitted.
280-
**Fix**: Re-sign the authorization payload with a fresh expiration ledger.
289+
**Fix**: Re-sign the authorization payload with a fresh expiration ledger.
290+
**Reference**: [Error Code Reference → stealth-registry #2 / stealth-sender #2 `Unauthorized`](/reference/error-codes#stealth-registry)
281291
```typescript
282292
// When generating the Soroban auth payload, extend the valid ledger range
283293
const currentLedger = await getLatestLedger();
@@ -290,7 +300,8 @@ const auth = createSorobanAuth({
290300
### 20. `Replay rejection` / `nonce_already_used`
291301
**Meaning**: The contract invocation was rejected because its unique nonce was already used.
292302
**Cause**: Submitting the same signed Soroban payload twice.
293-
**Fix**: Query the contract for the latest nonce for the user, and increment it for the new invocation.
303+
**Fix**: Query the contract for the latest nonce for the user, and increment it for the new invocation.
304+
**Reference**: [Error Code Reference → Soroban Contract Errors](/reference/error-codes#soroban-contract-errors)
294305
```typescript
295306
// Always fetch the latest nonce before building the Soroban invocation
296307
const nextNonce = await myContract.getNonce({ user: userAddress });

0 commit comments

Comments
 (0)