Skip to content

docs: [swap] document /order errorMessage strings and 400 error shape - #955

Open
0xanmol wants to merge 1 commit into
mainfrom
fix/swap-v2-order-error-messages
Open

0xanmol wants to merge 1 commit into
mainfrom
fix/swap-v2-order-error-messages

Conversation

@0xanmol

@0xanmol 0xanmol commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

The V2 docs listed the /order errorCode values with a paraphrase ("Swap below minimum for gasless") but never showed the string the API actually returns, and dropped the message templates the V1/Ultra spec carried. An integrator building their own swap UI hit this: they could not tell from the V2 page what errorMessage would contain, tested it in the playground, and asked whether the V1 strings still apply.

Verified against the live API on 2026-09-15 (quote-only, nothing signed). The same errorCode: 3 returns Minimum $5 for gasless for a JUP swap and Minimum $10 for gasless for a W swap, so the figure is worked out per request, not fixed.

Changes

  • Each router + errorCode pair now shows the message the API returns, on both the docs page and the spec
  • Says the gasless minimum inside the message varies per request, and that errorMessage is display-only, so logic keys off router + errorCode
  • Documents the HTTP 400 shape, which carries requestId and error only and no errorCode at all. A client that reads errorCode unconditionally breaks on that path
  • Notes that these codes apply to /order, not /execute (which uses a separate code field)
  • Live findings recorded in .claude/rules/product-learning.md

Deliberately not changed

Aggregator errorCode: 2. We publish it as "Insufficient SOL for gas". That string is not in the source at all (the constant reads Top up 0.01 SOL for gas), the branch has no call sites in swap-api, and it could not be reproduced in ~30 live attempts. This PR marks the row "Not currently returned" rather than deleting it, because whether it is retired or orphaned is an owner call. @yy if it is retired, the row should come out entirely in a follow-up.

JupiterZ errorCode: 4 ("Token account is frozen") stays undocumented: it exists in source but is intercepted before it can be returned.

Also left alone: the formula behind the gasless minimum (internal, will drift), the full list of ~20 HTTP 400 strings (mostly input validation), and any deprecation language on error (no removal path exists in code).

Linear Issues

  • Fixes BUILD-881 — [Swap] Document /order errorMessage strings and 400 error shape for V2

Checklist

  • node generate-llms-from-docs.js run
  • mint broken-links passes
  • node check-redirects.js passes (no redirects changed)
  • All pages have title, description, llmsDescription
  • docs.json navigation updated (no nav change)
  • Redirects added (no paths changed)
  • Changelog entry (not needed, no public API change)
  • .claude/rules/ updated with any learnings or decisions

🤖 Generated with Claude Code

The V2 docs listed errorCode values with a paraphrase but never showed the
string the API returns, and dropped the message templates the V1/Ultra spec
carried. An integrator building their own swap UI had to hit the playground to
find out what /order actually returns.

Verified live on 2026-09-15 (quote-only): the same errorCode 3 returns
"Minimum $5 for gasless" for a JUP swap and "Minimum $10 for gasless" for a W
swap, so the figure is per request, not fixed.

- Show the returned message for each router + errorCode pair
- State that the gasless minimum varies per request and that errorMessage is
  display-only, so logic keys off router + errorCode
- Document the HTTP 400 shape, which carries no errorCode at all
- Note that these codes do not apply to /execute
- Mark aggregator errorCode 2 as not currently returned, pending an owner call
  on whether it is retired or orphaned

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mintlify

mintlify Bot commented Sep 15, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Jupiter 🟢 Ready View Preview Sep 15, 2026, 12:24 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant