docs: document missing and fix erroneous JSON-RPC error codes - #9496
Open
daywalker90 wants to merge 1 commit into
Open
docs: document missing and fix erroneous JSON-RPC error codes#9496daywalker90 wants to merge 1 commit into
daywalker90 wants to merge 1 commit into
Conversation
Andezion
reviewed
Sep 11, 2026
Andezion
left a comment
Collaborator
There was a problem hiding this comment.
The three splice commands (splice_init, splice_update, splice_signed) got the most extensive new errors sections in this pr (351-356). Did the audit include the async failure paths in lightningd/channel_control.c, or only the synchronous raises in param_channel_for_splice? i ask because i found several more splice-specific codes that appear to reach the pending rpc command via splice_command_for_chan():
- SPLICE_BROADCAST_FAIL = 350 (check_utxo_block, line 564)
- SPLICE_FUNDING_LOW = 357 (handle_splice_funding_error, line 245)
- SPLICE_STATE_ERROR = 358 (handle_splice_state_error, line 275)
- SPLICE_LOW_FEE/SPLICE_HIGH_FEE = 359/360 (handle_splice_feerate_error, line 305)
- SPLICE_ABORT = 362 (handle_splice_abort, line 364)
- SPLICE_CHANNEL_ERROR = 363 (channel_control_errmsg, line 1740)
Audit the `errors` sections of the RPC schemas against the error codes the handlers actually raise, and fix the discrepancies. FUNDING_STILL_SYNCING_BITCOIN (304) is only raised by `fundpsbt` and `utxopsbt` (wallet/reservation.c), and is forwarded verbatim by every other command which can return it. Document it on `fundpsbt`, `utxopsbt`, `txprepare`, `withdraw`, `multiwithdraw`, `upgradewallet`, `fundchannel` and `multifundchannel`. Conversely, `fundchannel_start` and `openchannel_init` do not call either: when the node is not synced they delay via topology_add_sync_waiter() and retry, so drop their stale 304. Also fix the remaining discrepancies: - `delpay` documented 211 for a status mismatch, but that path returns 208 (PAY_NO_SUCH_PAYMENT); 211 is never raised by `delpay`, so replace it; - document missing codes: `createinvoice` 907 (INVOICE_OFFER_INACTIVE), `enableoffer` 1007 (OFFER_USED_SINGLE_USE), `getroutes` 217 (PAY_USER_ERROR) and `addpsbtoutput` 302/309; - add `errors` sections to `splice_init`, `splice_update` and `splice_signed` (351-356), `disableoffer` and `disableinvoicerequest` (1001), `preapproveinvoice` (213), `preapprovekeysend` (214) and `recover` (1600). The splice commands can also fail asynchronously, after the command has gone pending, through the channeld message handlers in channel_control.c which resolve the pending command via splice_command_for_chan(). Document those codes too: 350 (SPLICE_BROADCAST_FAIL) on `splice_signed`; 357/359/360 (SPLICE_FUNDING_LOW/SPLICE_LOW_FEE/SPLICE_HIGH_FEE) on `splice_update`; and 358/362/363 (SPLICE_STATE_ERROR/SPLICE_ABORT/ SPLICE_CHANNEL_ERROR) on all three. Changelog-None
daywalker90
force-pushed
the
fix-wrong-missing-error-codes
branch
from
September 11, 2026 11:53
94096ff to
3f359c0
Compare
Collaborator
Author
|
Good catch. I added those as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Audit the
errorssections of the RPC schemas against the error codes the handlers actually raise, and fix the discrepancies.FUNDING_STILL_SYNCING_BITCOIN (304) is only raised by
fundpsbtandutxopsbt(wallet/reservation.c), and is forwarded verbatim by every other command which can return it. Document it onfundpsbt,utxopsbt,txprepare,withdraw,multiwithdraw,upgradewallet,fundchannelandmultifundchannel. Conversely,fundchannel_startandopenchannel_initdo not call either: when the node is not synced they delay via topology_add_sync_waiter() and retry, so drop their stale 304.Also fix the remaining discrepancies:
delpaydocumented 211 for a status mismatch, but that path returns 208 (PAY_NO_SUCH_PAYMENT); 211 is never raised bydelpay, so replace it;createinvoice907 (INVOICE_OFFER_INACTIVE),enableoffer1007 (OFFER_USED_SINGLE_USE),getroutes217 (PAY_USER_ERROR) andaddpsbtoutput302/309;errorssections tosplice_init,splice_updateandsplice_signed(351-356),disableofferanddisableinvoicerequest(1001),preapproveinvoice(213),preapprovekeysend(214) andrecover(1600).Changelog-None
Important
26.09 FREEZE August 5th: Non-bugfix PRs not ready by this date will wait for 26.12.
RC1 is scheduled on August 17th
The final release is scheduled for September 7th.
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:
tools/lightning-downgrade