TaskStop reports 'No task found' but background process still running

Resolved 💬 3 comments Opened Apr 3, 2026 by corby Closed Apr 7, 2026

Bug Description

When using TaskStop to stop a background task, it sometimes returns "No task found with ID: <id>" even though the underlying process (launched via run_in_background: true on Bash tool) is still running and holding resources (e.g., TCP ports).

Steps to Reproduce

  1. Launch a long-running background process:

``
JLinkGDBServerCLExe -device AP510NFA-CBR -if SWD -speed auto -nohalt
`
with
run_in_background: true — returns task ID e.g. brbcfe181`

  1. The task eventually completes/fails and a <task-notification> is received with status failed or completed
  1. Later, attempt TaskStop with the same task ID:

``
TaskStop(task_id="brbcfe181")
`
Returns:
"No task found with ID: brbcfe181"`

  1. However, pgrep -fa JLinkGDBServer shows the process is still running and holding port 19021

Expected Behavior

Either:

  • TaskStop should be able to stop the process even after the task notification was received, OR
  • The process should be fully terminated when the task notification fires (no zombie/orphan processes)

Actual Behavior

The task is removed from the task registry after the notification fires, but the underlying OS process survives. This leaves orphaned processes holding resources (TCP ports, file handles), causing port conflicts when launching replacements.

Workaround

Currently using kill <pid> directly, but this defeats the purpose of the task management system and is error-prone.

Environment

  • Claude Code CLI on Linux (Ubuntu 24.04)
  • Model: Claude Opus 4.6
  • Processes affected: JLinkGDBServerCLExe, JLinkRTTClient (long-running daemon-style processes)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗