{"id":"0256d7971bab46a6","repo":"docker/cli","slug":"cannot-attach-stdin-to-a-tty-enabled-container-bec","errorCode":null,"errorMessage":"cannot attach stdin to a TTY-enabled container because stdin is not a terminal","messagePattern":"cannot attach stdin to a TTY-enabled container because stdin is not a terminal","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/streams/in.go","lineNumber":74,"sourceCode":"// value.\nfunc (i *In) SetRawTerminal() error {\n\treturn i.cs.setRawTerminal(term.SetRawTerminal)\n}\n\n// RestoreTerminal restores the terminal state if SetRawTerminal succeeded earlier.\nfunc (i *In) RestoreTerminal() {\n\ti.cs.restoreTerminal()\n}\n\n// CheckTty reports an error when stdin is requested for a TTY-enabled\n// container, but the client stdin is not itself a terminal (for example,\n// when input is piped or redirected).\nfunc (i *In) CheckTty(attachStdin, ttyMode bool) error {\n\t// TODO(thaJeztah): consider inlining this code and deprecating the method.\n\tif !ttyMode || !attachStdin || i.cs.isTerminal() {\n\t\treturn nil\n\t}\n\treturn errors.New(\"cannot attach stdin to a TTY-enabled container because stdin is not a terminal\")\n}\n\n// SetIsTerminal overrides whether a terminal is connected. It is used to\n// override this property in unit-tests, and should not be depended on for\n// other purposes.\nfunc (i *In) SetIsTerminal(isTerminal bool) {\n\ti.cs.setIsTerminal(isTerminal)\n}\n","sourceCodeStart":56,"sourceCodeEnd":83,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/streams/in.go#L56-L83","documentation":"Error \"cannot attach stdin to a TTY-enabled container because stdin is not a terminal\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/streams/in.go:74 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}