{"record":{"id":"339e7809b9c8bb71","repo":"docker/compose","slug":"can-t-use-progress-plain-while-ansi-support-is-f","errorCode":null,"errorMessage":"can't use --progress plain while ANSI support is forced","messagePattern":"can't use --progress plain while ANSI support is forced","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/compose.go","lineNumber":676,"sourceCode":"\tcase \"\", display.ModeAuto:\n\t\tswitch {\n\t\tcase ansi == \"never\":\n\t\t\tdisplay.Mode = display.ModePlain\n\t\t\treturn display.Plain(dockerCli.Err()), nil\n\t\tcase dockerCli.Err().IsTerminal():\n\t\t\treturn display.Full(dockerCli.Err(), stdinfo(dockerCli), detached), nil\n\t\tdefault:\n\t\t\treturn display.Plain(dockerCli.Err()), nil\n\t\t}\n\tcase display.ModeTTY:\n\t\tif ansi == \"never\" {\n\t\t\treturn nil, fmt.Errorf(\"can't use --progress tty while ANSI support is disabled\")\n\t\t}\n\t\tdisplay.Mode = display.ModeTTY\n\t\treturn display.Full(dockerCli.Err(), stdinfo(dockerCli), detached), nil\n\tcase display.ModePlain:\n\t\tif ansi == \"always\" {\n\t\t\treturn nil, fmt.Errorf(\"can't use --progress plain while ANSI support is forced\")\n\t\t}\n\t\tdisplay.Mode = display.ModePlain\n\t\treturn display.Plain(dockerCli.Err()), nil\n\tcase display.ModeQuiet, \"none\":\n\t\tdisplay.Mode = display.ModeQuiet\n\t\treturn display.Quiet(), nil\n\tcase display.ModeJSON:\n\t\tdisplay.Mode = display.ModeJSON\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t\treturn display.JSON(dockerCli.Err()), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported --progress value %q\", progress)\n\t}\n}\n\nfunc setEnvWithDotEnv(opts ProjectOptions, dockerCli command.Cli) error {\n\t// Check if we're using a remote config (OCI or Git)\n\t// If so, skip env loading as remote loaders haven't been initialized yet","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/compose.go#L658-L694","documentation":"Docker Compose CLI rejects the combination `--progress plain` with `--ansi always`. The progress display mode 'plain' (no ANSI escape sequences) is logically incompatible with forcing ANSI output, so the mode selector in cmd/compose/compose.go aborts before configuring the display writer.","triggerScenarios":"Running any compose command with both `--progress plain` and `--ansi always` (or the COMPOSE_PROGRESS/ansi env vars resolving to that combination). The switch on progress mode hits `case display.ModePlain` and sees the ansi setting == \"always\".","commonSituations":"CI scripts that pin `--ansi always` for colored logs and later add `--progress plain` to make build output greppable; shell aliases that set one flag and muscle-memory typing the other; env var COMPOSE_ANSI=always combined with a --progress plain flag.","solutions":["Drop `--ansi always` and let compose auto-detect ANSI support, keeping `--progress plain`.","Or keep `--ansi always` and change `--progress` to `auto` or `tty`.","Check for a shell alias or COMPOSE_ANSI environment variable forcing `always` when you did not pass it explicitly."],"exampleFix":"# before\ndocker compose --ansi always --progress plain up --build\n\n# after\ndocker compose --progress plain up --build","handlingStrategy":"validation","validationCode":"# bash: check before invoking compose\nansi=\"${COMPOSE_ANSI:-auto}\"; progress=\"plain\"\nif [ \"$ansi\" = \"always\" ] && [ \"$progress\" = \"plain\" ]; then\n  echo \"refusing: --progress plain conflicts with ansi=$ansi\" >&2; exit 2\nfi\ndocker compose --ansi \"$ansi\" --progress \"$progress\" up -d","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hardcode --ansi always in shared scripts; leave detection automatic.","Keep one place (a wrapper function) that assembles progress/ansi flags so conflicts are impossible."],"tags":["cli","progress","ansi","flags","conflict"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}