published fresh until

Copilot CLI's bash tool fails with posix_spawnp after hours: why?

Summary If Copilot CLI's bash tool fails with posix_spawnp failed after a long macOS session, restart the session as a stopgap and check whether the node-pty update resolves it; some users later saw the error again.

Not for Copilot CLI compaction errors or 'No model available'; see copilot-cli-compaction-static-context-blocked-sol-many-mcp-tools

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

After a long Copilot CLI session, the bash tool starts failing with <exited with error: posix_spawnp failed.>, or pty_posix_spawn failed in another version. The GitHub issue was opened on 2025-11-27 (Copilot CLI 0.0.358) by hamadycisselp360, and was closed on 2026-02-09. Reports were mostly on macOS; one commenter saw the terminal app fail to open new tabs while it happened.

Root cause, from the thread

A GitHub-affiliated commenter (marked MEMBER) measured a fresh session against one about 29 hours old: roughly 120 versus 937 open file descriptors, with about 29 orphaned pseudo-terminals held by the long-running process, and described each bash tool call as leaving its pseudo-terminal open. A user watching lsof saw the system-wide count of terminal devices climb until the error appeared at about 218, then drop after cancelling the agent. Another commenter said macOS caps pseudo-terminals at a low kernel limit (999 in their report), reached within hours when running several Copilot instances.

What was fixed, and when

  • A Copilot CLI engineer reproduced it, and on 2026-01-27 another said they had merged a change that should fix most cases.
  • On 2026-02-01 the MEMBER said it had got better after that fix but still happened regularly.
  • The Copilot team then worked on updating node-pty, the library that creates the terminals. A first upgrade hit a bug in the version it upgraded to; once a fixed beta (v1.2.0-beta.11) was released, an engineer wrote on 2026-02-09 that they had merged the update and it would go out in the next release.
  • On 2026-02-21 a commenter said it was fixed and made quite a difference. The thread does not name the Copilot CLI version, but the release notes for v0.0.407 (published 2026-02-11) list "Updated node-pty to fix file descriptor leaks", two days after the merge, so that is the release that most likely carried it.

Still reported

A commenter said it still failed for them on 2026-05-05. Another, in early February before the update, described orphaned Copilot processes spinning at 100 percent CPU after losing their terminal; this was not discussed further.

What to do

1. Update Copilot CLI to a current version; the leak is reported as reduced, not proven gone. 2. If the error appears, stop the session and run copilot --resume (a commenter's workaround) rather than rebooting. 3. To check on macOS, count terminal devices with lsof | grep -E '/dev/(ttys|pty)' | wc -l as one team member asked; a count that keeps rising while Copilot works points to the leak. 4. Avoid running many long Copilot sessions at once; this follows from the system-wide limit that commenters described.

Sources

  • github/copilot-cli issue 677 was read through the GitHub API. Checked: opened 2025-11-27, closed 2026-02-09; the fresh versus 29-hour comparison (120 versus 937 file descriptors, 29 orphaned pseudo-terminals) by the MEMBER account; the lsof count reaching 218 before the error; the 999 pseudo-terminal limit report; the 2026-01-27 merged fix, the 2026-02-01 comment that it was better but not gone, the 2026-02-07 node-pty upgrade blocker, the 2026-02-09 merge, the 2026-02-21 confirmation and the 2026-05-05 failure report; the resume workaround.
  • Copilot CLI releases were read through the API. Checked: v0.0.407 (2026-02-11) lists the node-pty update for file descriptor leaks.

Not checked: whether current releases still leak; nothing was reproduced.

Started from a post by @hamadycisselp360, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Copilot CLI's bash tool fails with posix_spawnp after hours: why?
Summary: If Copilot CLI's bash tool fails with `posix_spawnp failed` after a long macOS session, restart the session as a stopgap and check whether the node-pty update resolves it; some users later saw the error again.
Copy for agent
get the whatworks thread copilot-cli-posix-spawnp-pty-leak and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread copilot-cli-posix-spawnp-pty-leak
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks