@@ -543,6 +543,7 @@ export const Chat = ({
543543 { error } ,
544544 '[followup-click] onSubmitPrompt failed with error' ,
545545 )
546+ showClipboardMessage ( 'Failed to send followup' , { durationMs : 3000 } )
546547 } )
547548 }
548549
@@ -997,12 +998,12 @@ export const Chat = ({
997998 let replacement : string
998999 const index = agentSelectedIndex
9991000 if ( index < agentMatches . length ) {
1000- const selected = agentMatches [ index ] || agentMatches [ 0 ]
1001+ const selected = agentMatches . length > 0 ? ( agentMatches [ index ] || agentMatches [ 0 ] ) : undefined
10011002 if ( ! selected ) return
10021003 replacement = `@${ selected . displayName } `
10031004 } else {
10041005 const fileIndex = index - agentMatches . length
1005- const selectedFile = fileMatches [ fileIndex ] || fileMatches [ 0 ]
1006+ const selectedFile = fileMatches . length > 0 ? ( fileMatches [ fileIndex ] || fileMatches [ 0 ] ) : undefined
10061007 if ( ! selectedFile ) return
10071008 replacement = `@${ selectedFile . filePath } `
10081009 }
@@ -1060,12 +1061,20 @@ export const Chat = ({
10601061 }
10611062
10621063 const cwd = getProjectRoot ( ) ?? process . cwd ( )
1063- void addPendingImageFromFile ( result . imagePath , cwd , placeholderPath )
1064+ addPendingImageFromFile ( result . imagePath , cwd , placeholderPath ) . catch (
1065+ ( error ) => {
1066+ logger . error ( { error } , 'Failed to add pending image from file' )
1067+ showClipboardMessage ( 'Failed to add image' , { durationMs : 3000 } )
1068+ }
1069+ )
10641070 } , 0 )
10651071 } ,
10661072 onPasteImagePath : ( imagePath : string ) => {
10671073 const cwd = getProjectRoot ( ) ?? process . cwd ( )
1068- void validateAndAddImage ( imagePath , cwd )
1074+ validateAndAddImage ( imagePath , cwd ) . catch ( ( error ) => {
1075+ logger . error ( { error, imagePath } , 'Failed to validate and add image' )
1076+ showClipboardMessage ( 'Failed to add image' , { durationMs : 3000 } )
1077+ } )
10691078 } ,
10701079 onPasteText : ( text : string ) => {
10711080 setInputValue ( ( prev ) => {
0 commit comments