doc: document error 313 on every command which can return it
What changed, and why it matters
This commit only updates documentation. It adds error code 313 to the documented error lists for several Core Lightning commands (fundpsbt, utxopsbt, txprepare, multiwithdraw, and upgradewallet). The error code already existed in the code and was already documented for some commands; this change makes the documentation complete and consistent. No code behavior changes.
No security action required. This is a documentation-only change. Treat as routine documentation maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit is a documentation-only patch modifying JSON schema files. It documents the existing FUND_CANNOT_AFFORD_WITH_EMERGENCY (error 313) behavior across commands that can return it. The underlying error-raising logic in wallet/reservation.c (fundpsbt and utxopsbt) is unchanged. No executable code, validation logic, or security controls were modified.
Changed components
doc/schemas/fundpsbt.jsondoc/schemas/utxopsbt.jsondoc/schemas/txprepare.jsondoc/schemas/multiwithdraw.jsondoc/schemas/upgradewallet.jsoncontrib/msggen/msggen/schema.jsonInspect captured patch +30 / −8
### contrib/msggen/msggen/schema.json
@@ -16102,7 +16102,8 @@
"",
"- -32602: If the given parameters are wrong.",
"- -1: Catchall nonspecific error.",
- "- 301: Insufficient UTXOs to meet *satoshi* value."
+ "- 301: Insufficient UTXOs to meet *satoshi* value.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have or are opening anchor channels)."
],
"author": [
"Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
@@ -30957,7 +30958,8 @@
"",
"- -1: Catchall nonspecific error.",
"- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
- "- 302: The dust limit is not met."
+ "- 302: The dust limit is not met.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have anchor channels)."
],
"author": [
"ZmnSCPxj [ZmnSCPxj@protonmail.com](mailto:ZmnSCPxj@protonmail.com) is mainly responsible."
@@ -38500,7 +38502,8 @@
"",
"- -1: Catchall nonspecific error.",
"- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
- "- 302: The dust limit is not met."
+ "- 302: The dust limit is not met.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have anchor channels)."
],
"author": [
"Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
@@ -38872,6 +38875,13 @@
}
}
},
+ "errors": [
+ "On failure, an error is reported and no transaction is created.",
+ "",
+ "- -1: Catchall nonspecific error.",
+ "- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have anchor channels)."
+ ],
"usage": [
"The caller is trying to buy a liquidity ad but the command keeps failing. They have funds in their wallet, but they're all P2SH-wrapped outputs.",
"",
@@ -39107,7 +39117,8 @@
"",
"- -32602: If the given parameters are wrong.",
"- -1: Catchall nonspecific error.",
- "- 301: Insufficient UTXOs to meet *satoshi* value."
+ "- 301: Insufficient UTXOs to meet *satoshi* value.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have or are opening anchor channels)."
],
"author": [
"Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
### doc/schemas/fundpsbt.json
@@ -194,7 +194,8 @@
"",
"- -32602: If the given parameters are wrong.",
"- -1: Catchall nonspecific error.",
- "- 301: Insufficient UTXOs to meet *satoshi* value."
+ "- 301: Insufficient UTXOs to meet *satoshi* value.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have or are opening anchor channels)."
],
"author": [
"Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
### doc/schemas/multiwithdraw.json
@@ -72,7 +72,8 @@
"",
"- -1: Catchall nonspecific error.",
"- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
- "- 302: The dust limit is not met."
+ "- 302: The dust limit is not met.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have anchor channels)."
],
"author": [
"ZmnSCPxj [ZmnSCPxj@protonmail.com](mailto:ZmnSCPxj@protonmail.com) is mainly responsible."
### doc/schemas/txprepare.json
@@ -81,7 +81,8 @@
"",
"- -1: Catchall nonspecific error.",
"- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
- "- 302: The dust limit is not met."
+ "- 302: The dust limit is not met.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have anchor channels)."
],
"author": [
"Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
### doc/schemas/upgradewallet.json
@@ -63,6 +63,13 @@
}
}
},
+ "errors": [
+ "On failure, an error is reported and no transaction is created.",
+ "",
+ "- -1: Catchall nonspecific error.",
+ "- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have anchor channels)."
+ ],
"usage": [
"The caller is trying to buy a liquidity ad but the command keeps failing. They have funds in their wallet, but they're all P2SH-wrapped outputs.",
"",
### doc/schemas/utxopsbt.json
@@ -191,7 +191,8 @@
"",
"- -32602: If the given parameters are wrong.",
"- -1: Catchall nonspecific error.",
- "- 301: Insufficient UTXOs to meet *satoshi* value."
+ "- 301: Insufficient UTXOs to meet *satoshi* value.",
+ "- 313: The `min-emergency-msat` reserve could not be preserved (and we have or are opening anchor channels)."
],
"author": [
"Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.