copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

TypeError: Cannot read properties of undefined (reading 'startsWith')

Open driskell opened this issue 2 months ago • 12 comments

Describe the bug

When asked to choose something, e.g.:

Do you want to run this command?

❯ 1. Yes
   2. No, and tell Copilot what to do differently (Esc)
Confirm with number keys or ↑↓ keys and Enter, Cancel with Esc

On macOS if you use the keyboard numpad's Enter key you will then see the following appear above the box:

✗ TypeError: Cannot read properties of undefined (reading 'startsWith')

Additionally, the entire session then becomes unresponsive.

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

driskell avatar Oct 17 '25 16:10 driskell

What version are you running? (copilot --version)

williammartin avatar Oct 17 '25 16:10 williammartin

And what version of node? (node --version)

williammartin avatar Oct 17 '25 16:10 williammartin

0.0.343

Node 22.20.0

driskell avatar Oct 17 '25 19:10 driskell

I'm experiencing the same issue.

Copilot version: 0.0.351 Commit: 90770bc Node: v22.20.0

It happened several times today.

Stacktrace:

2025-10-27T18:41:17.386Z [ERROR] Uncaught Exception: Cannot read properties of undefined (reading 'startsWith')
TypeError: Cannot read properties of undefined (reading 'startsWith')
    at EventEmitter.I (file:///Users/dlombard/.nvm/versions/node/v22.20.0/lib/node_modules/@github/copilot/index.js:819:1670)
    at EventEmitter.emit (node:events:531:35)
    at ReadStream.handleReadable (file:///Users/dlombard/.nvm/versions/node/v22.20.0/lib/node_modules/@github/copilot/index.js:815:489)
    at ReadStream.emit (node:events:519:28)
    at emitReadable_ (node:internal/streams/readable:834:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:89:21)

dlombard avatar Oct 27 '25 18:10 dlombard

I've been hitting this over and over on my Mac - Node hangs and I have to force kill it in Activity Monitor.

artl93 avatar Nov 05 '25 05:11 artl93

I haven't been able to reproduce this when emulating the Enter key, but I don't have a Mac keyboard with a numpad to try it with a physical keyboard.

Does this happen every time you use that key? Does it only happen on the numbered prompts? Does it happen if you try to submit a text prompt with it?

williammartin avatar Nov 05 '25 16:11 williammartin

Hi @williammartin

It only happens for me on number prompts. Not on text prompts.

It happens every time.

driskell avatar Nov 05 '25 16:11 driskell

Thanks. What terminal emulator and shell are you using?

williammartin avatar Nov 05 '25 16:11 williammartin

I'm using iTerm2 on the Mac - not an emulator. Seems to consistently happen when picking a number as to how to execute a tool.

artl93 avatar Nov 05 '25 16:11 artl93

I'm having the same issue both when starting copilot and selecting to use current folder and when approving to run a tool and have to close terminal window.

When I select approve for this and future sessions it works.

Copilot Version 0.0.362

weynars avatar Nov 21 '25 00:11 weynars

Also running into this when using the numblock (hitting "Enter").

 Welcome to GitHub Copilot CLI
 Version 0.0.362 · Commit 0c95944

iTerm2, zsh, node 25

stephannielsen avatar Nov 24 '25 08:11 stephannielsen

On a pure text input, hitting enter prints this in the prompt field:

Image

For any key on a numpad. character might be different, all show like this though. MacOS with external keyboard (not apple).

stephannielsen avatar Nov 24 '25 17:11 stephannielsen