Skip to content

fix: reject unknown token symbols with error instead of allowing continuation (Vibe Kanban)#8

Merged
MinaraAgent merged 3 commits intomainfrom
vk/5964-fix-unknown-toke
Apr 3, 2026
Merged

fix: reject unknown token symbols with error instead of allowing continuation (Vibe Kanban)#8
MinaraAgent merged 3 commits intomainfrom
vk/5964-fix-unknown-toke

Conversation

@MinaraAgent
Copy link
Copy Markdown
Member

@MinaraAgent MinaraAgent commented Apr 3, 2026

Summary

  • Modified lookupToken() in src/utils.ts to throw an Unknown token error when a token cannot be resolved, instead of returning the raw input and allowing the flow to continue
  • Removed the previous behavior that would warn and return { address: tokenInput } for unknown tokens
  • Updated the catch block to properly re-throw "Unknown token" errors and throw a clear error for any other lookup failures

Changes Made

src/utils.ts - Modified the lookupToken() function:

  • Before: When no token was found, the function would log a warning (for ticker inputs) and return { address: tokenInput }, allowing invalid tokens to proceed through the flow
  • After: Throws Error("Unknown token: ${tokenInput}") immediately when token lookup fails, preventing invalid tokens from reaching the confirmation step

Why This Matters

Previously, when a user entered a fictional/unknown token symbol like $FAKETOKEN, the CLI would:

  1. Warn that no token was found
  2. Pass the invalid token through to the confirmation screen
  3. Only fail at execution time

Now, the CLI:

  1. Throws an error immediately during token lookup
  2. The error is caught by wrapAction() and displayed cleanly to the user
  3. Process exits with code 1, preventing any further action

This affects all commands that use lookupToken():

  • swap
  • transfer
  • withdraw
  • limit-order

Testing

  • TypeScript compilation passes (tsc --noEmit)
  • Manual testing with fictional token symbols will now show: ✖ Unknown token: $FAKETOKEN

This PR was written using Vibe Kanban

claude and others added 2 commits April 3, 2026 06:59
…inuation

Modify lookupToken() to throw an error when a token cannot be resolved,
preventing invalid tokens from reaching the confirmation step in swap,
transfer, withdraw, and limit-order commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ers an unknown/fictional token symbol, the CLI throws an error immediately during token lookup, rather than allowing the invalid token to proceed to the confirmation step.
@MinaraAgent MinaraAgent changed the title Reject unknown token symbols before confirmation in minara-cli. (vibe-kanban) fix: reject unknown token symbols with error instead of allowing continuation (Vibe Kanban) Apr 3, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates project dependencies and modifies the lookupToken utility in src/utils.ts to throw errors instead of returning partial data when a token cannot be found. Review feedback suggests refining the error handling to distinguish between API failures and missing tokens for better user clarity. Additionally, the catch block should be updated to avoid masking prompt cancellations or other system errors as 'Unknown token' issues, which currently interferes with the CLI's ability to exit gracefully.

Comment thread src/utils.ts Outdated
Comment thread src/utils.ts Outdated
- Distinguish API failures from unknown tokens in error messages
- Re-throw all errors to preserve prompt cancellation handling
- Allow wrapAction to properly handle Ctrl+C during token selection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MinaraAgent MinaraAgent merged commit 7fb3f70 into main Apr 3, 2026
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.

2 participants