slimtoolkit/slim · error
not a terminal
Error message
not a terminal
What it means
Raised in Start (pkg/app/master/container/execution.go) when ref.options.Terminal is requested but os.Stdout is not attached to a TTY — term.GetFdInfo reports isTerminal == false. Raw-terminal mode can only be set on a real terminal, so attaching an interactive terminal session fails.
Source
Thrown at pkg/app/master/container/execution.go:294
if ref.eventCh != nil {
ref.eventCh <- &ExecutionEvenInfo{
Event: XECreated,
}
}
go ref.monitorContainerExitSync()
if ref.cleanupOnSysExit {
go ref.monitorSysExitSync()
}
if ref.options != nil {
if ref.options.Terminal {
var oldState *term.State
var isTerminal bool
ref.termFd, isTerminal = term.GetFdInfo(os.Stdout)
if !isTerminal {
return errors.New("not a terminal")
}
oldState, err = term.SetRawTerminal(ref.termFd)
if err != nil {
return err
}
defer term.RestoreTerminal(ref.termFd, oldState)
ref.terminalExitChan = make(chan error)
go ref.startTerminal()
} else if ref.options.LiveLogs {
go ref.startLiveLogs()
}
}
if err := ref.APIClient.StartContainer(ref.ContainerID, nil); err != nil {View on GitHub (pinned to 81940d17fa)
Solutions
- Disable the terminal option so output streams non-interactively
- Run the command in a real TTY (allocate a pty, e.g. docker run -t / script -c)
- Use tools like `script` or a pty wrapper if you must keep terminal mode in automation
Example fix
// before
opts := ContainerOptions{Terminal: true}
err := ref.Start(ctx)
// after
isTTY := term.IsTerminal(int(os.Stdout.Fd()))
opts := ContainerOptions{Terminal: isTTY}
err := ref.Start(ctx) Defensive patterns
Strategy: validation
Validate before calling
if opts.Terminal && !term.IsTerminal(int(os.Stdout.Fd())) {
opts.Terminal = false
} Try / catch
// Go
if err := ref.Start(ctx); err != nil && err.Error() == "not a terminal" {
// fall back to non-interactive start
} Prevention
- Auto-disable terminal mode when stdout is not a TTY
- Run interactive sessions from a real terminal, not CI log capture
- Allocate a pty (docker -t / script) when terminal mode is required
When it happens
Trigger: Starting/exec'ing a container with terminal options enabled while stdout is a pipe, a file, or a non-interactive CI log stream.
Common situations: Running docker-slim's interactive terminal mode from CI pipelines or inside another container without -t; redirecting output to a file; running under a non-TTY docker exec.
Related errors
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/3a660a65193cf873.
Report an issue: GitHub.