deepseek-ai/deepseek-harness · error · TerminalBackendCleanupError

PTY backend startup and cleanup both failed

Error message

PTY backend startup and cleanup both failed

What it means

Error "PTY backend startup and cleanup both failed" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/terminal/terminal-bash/src/index.ts:199

    if (argv[0] === undefined) throw new Error('terminal-bash: sandbox returned empty argv')
    const terminal = await this.spawnTerminal({
      argv,
      cwd: spec.cwd ?? policy.workspaceRoot,
      env: childEnvironment(spec, this.config.shellDialect),
      rows: this.config.rows,
      cols: this.config.cols,
      graceMs: this.config.disposeGraceMs,
      signal: spec.signal,
    })
    const session = this.createSession(terminal, this.config)
    try {
      await startupSession(session, this.config.shellDialect, spec.signal)
      return session
    } catch (error) {
      try {
        await session.close('PTY startup failed')
      } catch (closeError: unknown) {
        throw new TerminalBackendCleanupError(error, closeError)
      }
      throw error
    }
  }
}

/** Register the local PTY backend. */
export function apply(ctx: Context, config: Config): void {
  const resolved = resolveConfig(config)
  validateConfig(resolved)
  ctx.terminals.registerBackend(new BashTerminalBackend(ctx, resolved))
}

View on GitHub (pinned to b150a551b8)

Solutions

  1. Fix the startup failure cause first, then clean up the leftover backend resources reported by the cleanup failure.

When it happens

Trigger: Thrown at packages/terminal/terminal-bash/src/index.ts:199 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/9b2bd582fa360f9c. Report an issue: GitHub.