File tree Expand file tree Collapse file tree
src/cortex-tui/src/runner/event_loop Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -467,6 +467,26 @@ impl EventLoop {
467467 return ;
468468 }
469469
470+ // Check if this is an insufficient balance error (402 Payment Required)
471+ if error_lower. contains ( "402" )
472+ || error_lower. contains ( "insufficient_balance" )
473+ || error_lower. contains ( "insufficient token balance" )
474+ || error_lower. contains ( "payment required" )
475+ {
476+ self . add_system_message (
477+ "Error: Insufficient token balance to continue the conversation.\n \n \
478+ Please recharge your account at: https://app.cortex.foundation\n \n \
479+ Once recharged, you can continue your conversation.",
480+ ) ;
481+ self . app_state
482+ . toasts
483+ . error ( "Insufficient balance. Please recharge at app.cortex.foundation" ) ;
484+ self . stream_controller . reset ( ) ;
485+ self . streaming_rx = None ;
486+ self . streaming_task = None ;
487+ return ;
488+ }
489+
470490 // Check if this is a rate limit / usage limit error
471491 if error_lower. contains ( "rate limit" )
472492 || error_lower. contains ( "usage limit" )
You can’t perform that action at this time.
0 commit comments