Skip to content

fix(wallets): throw typed InvalidSignerError when removeSigner API call fails#1909

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781017356-fix-removesigner-typed-error
Open

fix(wallets): throw typed InvalidSignerError when removeSigner API call fails#1909
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781017356-fix-removesigner-typed-error

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Description

When removeSigner receives an error response from the API ("error" in response), it threw new Error(...) — a generic Error that consumers cannot pattern-match by type.

This change makes removeSigner consistent with addSigner by throwing InvalidSignerError with:

  • response.message as the human-readable error message
  • Full response JSON as details (machine-inspectable via CrossmintSDKError.details)

Also renames the log key to wallet.removeSigner.failed for consistency with wallet.addSigner.failed.

Same error-masking pattern fixed for OTP validation (#1886), get-status (#1896), export-signer (#1897), and addSigner chain failure (#1898).

Test plan

  • Existing test suite passes (337 tests including Wallet - removeSigner() suite)
  • Lint passes (Biome)
  • No new error class — reuses existing InvalidSignerError for consistency with addSigner

Package updates

  • @crossmint/wallets-sdk — patch changeset added (fix-removesigner-typed-error.md)

Link to Devin session: https://crossmint.devinenterprise.com/sessions/7bd8230602444a8a94498384e0aac02d
Requested by: @xmint-guille

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author
Original prompt from Guille

@skills:cse spotpay reported the following, investigate when this could happen and how should we improve our error client side:
During wallet recovery, complete-onboarding returns OTP validation failed, but the app surfaces it as:
"Crossmint signer returned an internal error"

This happens in the wallet recovery/addSigner path, likely when registering the device signer after auth is required. Logs show:

  • wallet.recover.start
  • complete-onboarding request
  • complete-onboarding: OTP validation failed
  • wallet.addSigner threw
  • wallet.recover threw
  • Error in verifyOtp
  • Crossmint signer returned an internal error

The SDK should preserve the underlying auth/OTP failure reason instead of collapsing it into an internal signer error. Also distinguish true user cancellation from failed OTP / recovery errors.
ATTACHMENT:"https://crossmint.devinenterprise.com/attachments/76cc8351-35a7-4370-9a64-206aa1191469/CleanShot+2026-06-02+at+14.08.27%402x.png"

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(wallets): throw typed InvalidSignerE..." | Re-trigger Greptile

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