{"id":"0d1d10a006c48c4c","repo":"docker/cli","slug":"tty-service-logs-only-supported-with-raw","errorCode":null,"errorMessage":"tty service logs only supported with --raw","messagePattern":"tty service logs only supported with --raw","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/logs.go","lineNumber":106,"sourceCode":"\t\tres, err := apiClient.TaskInspect(ctx, opts.target, client.TaskInspectOptions{})\n\t\tif err != nil {\n\t\t\tif errdefs.IsNotFound(err) {\n\t\t\t\t// if the task isn't found, rewrite the error to be clear\n\t\t\t\t// that we looked for services AND tasks and found none\n\t\t\t\terr = fmt.Errorf(\"no such task or service: %v\", opts.target)\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\ttty = res.Task.Spec.ContainerSpec.TTY\n\t\tmaxLength = getMaxLength(res.Task.Slot)\n\n\t\t// we can't prettify tty logs. tell the user that this is the case.\n\t\t// this is why we assign the logs function to a variable and delay calling\n\t\t// it. we want to check this before we make the call and checking twice in\n\t\t// each branch is even sloppier than this CLI disaster already is\n\t\tif tty && !opts.raw {\n\t\t\treturn errors.New(\"tty service logs only supported with --raw\")\n\t\t}\n\n\t\t// now get the logs\n\t\tresponseBody, err = apiClient.TaskLogs(ctx, opts.target, client.TaskLogsOptions{\n\t\t\tShowStdout: true,\n\t\t\tShowStderr: true,\n\t\t\tSince:      opts.since,\n\t\t\tTimestamps: opts.timestamps,\n\t\t\tFollow:     opts.follow,\n\t\t\tTail:       opts.tail,\n\t\t\t// get the details if we request it OR if we're not doing raw mode\n\t\t\t// (we need them for the context to pretty print)\n\t\t\tDetails: opts.details || !opts.raw,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer responseBody.Close()","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/logs.go#L88-L124","documentation":"Raised by `docker service logs <task>` when the target task's container was created with TTY enabled (tty: true) and --raw was not passed. TTY output multiplexes stdout/stderr into a single raw stream with terminal control sequences, which the CLI's pretty log formatter (task-name prefixes, timestamps) cannot demultiplex, so it requires --raw.","triggerScenarios":"`docker service logs <task-id>` where the task belongs to a service created with `--tty`/`tty: true` in the compose/stack file; this branch fires when the target resolved to a task rather than a service.","commonSituations":"Services given tty: true in a stack file for interactive debugging or because an image/docs suggested it, then operators later trying to read logs of an individual task; older CLI versions couldn't show these logs at all.","solutions":["Add --raw: `docker service logs --raw <task>`.","If TTY isn't actually needed, remove it: `docker service update --tty=false <service>` or drop `tty: true` from the stack file, then redeploy.","Use `docker logs <container>` on the node running the task as an alternative."],"exampleFix":"# before\ndocker service logs my-svc.1.abc123\n# after\ndocker service logs --raw my-svc.1.abc123","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","swarm","services","logs","tty"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}