Skip to content

[BUG] Deleting a user wallet the second time returns 404 instead of removing it #4149

Closed

Description

@monasco

Describe the bug
On the admin Users page, deleting a wallet the second time should delete it for good. The endpoint says so: the first call is a soft delete, the second call removes the row. But the second call returns 404 "Wallet does not exist." and the wallet stays in the database with deleted = true.

To Reproduce

  1. Log in as admin and open the Users page.
  2. Open the wallets of a user and delete one wallet. This works, the wallet is marked as deleted.
  3. Delete the same wallet again. The dialog says "Wallet is already deleted, are you sure you want to permanently delete this user wallet?" Confirm.
  4. The API answers 404 and shows an error. The wallet is still in the database.

Same with the API: DELETE /users/api/v1/user/{user_id}/wallet/{wallet_id} two times.

Expected behavior
The second delete removes the wallet, like the endpoint summary says.

Desktop (please complete the following information):

  • LNbits version: dev, commit d941f0a (1.6.0)
  • Database: sqlite

Additional context
In lnbits/core/views/user_api.py, api_users_delete_user_wallet calls get_wallet(wallet). The default of get_wallet is deleted=False, so a soft deleted wallet is not found and the force_delete_wallet branch below is never reached. The undelete endpoint next to it passes deleted=True.

I have a fix and will open a pull request.

Activity

  1. self-assigned this
    on Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions