--- title: 'DF8206: Terminal Session Restart on Closed Stream' description: 'Terminal session "{id}" cannot be restarted; its output stream is already closed' --- ## Message > Terminal session "`{id}`" cannot be restarted; its output stream is already closed ## Cause `restart()` was called on a `startChildProcess()` or `startPtySession()` session whose output stream is already closed. The stream closes irreversibly on a natural process exit or after `terminate()`: it backs a single-use `ReadableStream` controller that cannot be reopened, so restarting in place is not possible once it has closed. ## Fix Drop the spent session with `ctx.terminals.remove(session)`, then spawn a replacement via `ctx.terminals.startChildProcess()` or `ctx.terminals.startPtySession()` with a fresh id. ## Source - [`packages/hub/src/node/host-terminals.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/host-terminals.ts): the `restart()` handle returned by `startChildProcess()` and `startPtySession()` throws this once the session's stream has closed.