lnp2pBot / lnp2pBot/bot

cancelHoldInvoice failures are swallowed silently — user gets no feedback when LND is down

Open
#899 2 comments 0 reactions 1 assignee View on GitHub

@ToRyVand is already working on this.

Since Aug 5, 2026.

Dominant language
TypeScript
Stars
292
Forks
136
Avg merge
19m
Merged PRs (30d)
1

Description

## Summary

When `cancelHoldInvoice` fails (e.g. LND is temporarily unreachable), all call
sites in `bot/commands.ts` and `bot/start.ts` catch the error via their outer
`try/catch`, log it, and return — without sending any message to the user.
The operation simply doesn't complete, and the user has no way of knowing
something went wrong.

## Background

Prior to #884, `cancelHoldInvoice` swallowed LND errors internally — it would
catch the failure, log it, and return `undefined` as if nothing had happened.
Callers had no way to detect a failure, so they would proceed to mark orders
as `CANCELED`, `CANCELED_BY_ADMIN`, or `SELLER_REFUNDED` even when the hold
invoice was never actually canceled. #884 fixed this by making
`cancelHoldInvoice` re-throw LND errors, consistent with `settleHoldInvoice`.
This made the failure visible to callers — but exposed that the command-based
call sites don't handle it with user feedback.

## Affected call sites

- `bot/commands.ts:322` — seller cancels in `WAITING_PAYMENT`
- `bot/commands.ts:534` — buyer cancels in `WAITING_BUYER_INVOICE`
- `bot/commands.ts:711` — cooperative cancel
- `bot/commands.ts:790` — admin cancel
- `bot/start.ts:445` — admin cancel (alternate path)
- `bot/start.ts:534` — cancel all orders

## Current behavior

LND fails → error is caught and logged → user sees nothing → order stays
in its current state.

## Expected behavior

LND fails → user receives an error message explaining the operation failed
and they can retry.

## Notes

- The job-based call sites (`cancel_orders.ts`, `check_hold_invoice_expired.ts`)
are fine — they retry automatically on the next run.
- A generic LND error message function may already exist in `bot/messages.ts`
— worth checking before adding new ones.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.