docker/cli ยท error

unable to set IO streams as raw terminal: %s

Error message

unable to set IO streams as raw terminal: %s

What it means

Error "unable to set IO streams as raw terminal: %s" thrown in docker/cli.

Source

Thrown at cli/command/container/hijack.go:105

	case err := <-detached:
		// Got a detach key sequence.
		return err
	case <-ctx.Done():
		return ctx.Err()
	}
}

func (h *hijackedIOStreamer) setupInput() (restore func(), _ error) {
	if h.inputStream == nil || !h.tty {
		// No need to setup input TTY.
		// The restore func is a nop.
		return func() {}, nil
	}
	if err := validateDetachKeys(h.detachKeys); err != nil {
		return nil, err
	}
	if err := setRawTerminal(h.streams); err != nil {
		return nil, fmt.Errorf("unable to set IO streams as raw terminal: %s", err)
	}

	// Use sync.Once so we may call restore multiple times but ensure we
	// only restore the terminal once.
	restore = sync.OnceFunc(func() {
		_ = restoreTerminal(h.streams, h.inputStream)
	})

	// Wrap the input to detect detach escape sequence.
	// Use default escape keys if an invalid sequence is given.
	escapeKeys := defaultEscapeKeys
	if h.detachKeys != "" {
		var err error
		escapeKeys, err = term.ToBytes(h.detachKeys)
		if err != nil {
			restore()
			return nil, err
		}

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/container/hijack.go:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/b2d129c16f7fe712.json. Report an issue: GitHub.