{"record":{"id":"3a660a65193cf873","repo":"slimtoolkit/slim","slug":"not-a-terminal","errorCode":null,"errorMessage":"not a terminal","messagePattern":"not a terminal","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/container/execution.go","lineNumber":294,"sourceCode":"\tif ref.eventCh != nil {\n\t\tref.eventCh <- &ExecutionEvenInfo{\n\t\t\tEvent: XECreated,\n\t\t}\n\t}\n\n\tgo ref.monitorContainerExitSync()\n\n\tif ref.cleanupOnSysExit {\n\t\tgo ref.monitorSysExitSync()\n\t}\n\n\tif ref.options != nil {\n\t\tif ref.options.Terminal {\n\t\t\tvar oldState *term.State\n\t\t\tvar isTerminal bool\n\t\t\tref.termFd, isTerminal = term.GetFdInfo(os.Stdout)\n\t\t\tif !isTerminal {\n\t\t\t\treturn errors.New(\"not a terminal\")\n\t\t\t}\n\n\t\t\toldState, err = term.SetRawTerminal(ref.termFd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdefer term.RestoreTerminal(ref.termFd, oldState)\n\n\t\t\tref.terminalExitChan = make(chan error)\n\n\t\t\tgo ref.startTerminal()\n\t\t} else if ref.options.LiveLogs {\n\t\t\tgo ref.startLiveLogs()\n\t\t}\n\t}\n\n\tif err := ref.APIClient.StartContainer(ref.ContainerID, nil); err != nil {","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/container/execution.go#L276-L312","documentation":"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.","triggerScenarios":"Starting/exec'ing a container with terminal options enabled while stdout is a pipe, a file, or a non-interactive CI log stream.","commonSituations":"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.","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"],"exampleFix":"// before\nopts := ContainerOptions{Terminal: true}\nerr := ref.Start(ctx)\n// after\nisTTY := term.IsTerminal(int(os.Stdout.Fd()))\nopts := ContainerOptions{Terminal: isTTY}\nerr := ref.Start(ctx)","handlingStrategy":"validation","validationCode":"if opts.Terminal && !term.IsTerminal(int(os.Stdout.Fd())) {\n\topts.Terminal = false\n}","typeGuard":null,"tryCatchPattern":"// Go\nif err := ref.Start(ctx); err != nil && err.Error() == \"not a terminal\" {\n\t// fall back to non-interactive start\n}","preventionTips":["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"],"tags":["terminal","tty","container"],"backgroundTag":"not-a-tty","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}