diff --git a/packages/jupyter-ai/src/components/chat-input.tsx b/packages/jupyter-ai/src/components/chat-input.tsx
index 4ab9bcd36..ddc2d4209 100644
--- a/packages/jupyter-ai/src/components/chat-input.tsx
+++ b/packages/jupyter-ai/src/components/chat-input.tsx
@@ -207,6 +207,7 @@ export function ChatInput(props: ChatInputProps): JSX.Element {
     props.chatHandler.sendMessage({ prompt, selection });
   }
 
+  const inputExists = !!input.trim();
   function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
     if (event.key !== 'Enter') {
       return;
@@ -218,6 +219,12 @@ export function ChatInput(props: ChatInputProps): JSX.Element {
       return;
     }
 
+    if (!inputExists) {
+      event.stopPropagation();
+      event.preventDefault();
+      return;
+    }
+
     if (
       event.key === 'Enter' &&
       ((props.sendWithShiftEnter && event.shiftKey) ||
@@ -240,7 +247,6 @@ export function ChatInput(props: ChatInputProps): JSX.Element {
     </span>
   );
 
-  const inputExists = !!input.trim();
   const sendButtonProps: SendButtonProps = {
     onSend,
     sendWithShiftEnter: props.sendWithShiftEnter,