{"record":{"id":"dac0b003c91f5a8f","repo":"dagger/dagger","slug":"service-s-does-not-support-terminal","errorCode":null,"errorMessage":"service %s does not support terminal","messagePattern":"service (.+?) does not support terminal","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/terminal.go","lineNumber":384,"sourceCode":"\tdefer term.Close(bkgwpb.UnknownExitStatus) // always close term; it's wrapped in a once so it won't be called multiple times\n\n\tenv := prepTerminalEnv(output, nil)\n\n\tquery, err := CurrentQuery(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsvcs, err := query.Services(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\trunning, release, err := svcs.StartResultWithDependencyExitPropagationSuppressed(ctx, svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer release()\n\tif running.Exec == nil {\n\t\treturn fmt.Errorf(\"service %s does not support terminal\", svcID.Path())\n\t}\n\treturn running.Exec(ctx, args.Cmd, env, &ServiceIO{\n\t\tStdin:       term.Stdin,\n\t\tStdout:      term.Stdout,\n\t\tStderr:      term.Stderr,\n\t\tResizeCh:    term.ResizeCh,\n\t\tInteractive: true,\n\t})\n}\n\nfunc prepTerminal(ctx context.Context, svcID *call.ID, execErr error) (*engineutil.TerminalClient, *termenv.Output, error) {\n\tquery, err := CurrentQuery(ctx)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to get current query: %w\", err)\n\t}\n\tbk, err := query.Engine(ctx)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to get engine client: %w\", err)","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/terminal.go#L366-L402","documentation":"Thrown by Service.terminal when the service was started but has no Exec function attached (running.Exec == nil, core/terminal.go:383-385). A service terminal requires a running process the user can exec into; services without an executable process (e.g. those representing only a network endpoint built from a container whose command isn't tracked as an exec) cannot host an interactive terminal.","triggerScenarios":"Attaching a terminal to a Service (Service.terminal / `dagger terminal` on a service) whose running state has Exec == nil — i.e. the service has no associated command process to attach to.","commonSituations":"Running `dagger call ... terminal` on a service created purely from ports/proxies, or a service whose container never ran a command, or SDK-generated services without explicit exec processes.","solutions":["Attach the terminal to the underlying Container instead of the Service (container.terminal()).","Ensure the service's container defines a real command (WithExec) so an Exec process exists.","Use `dagger shell`/exec into the container image manually as a fallback."],"exampleFix":"// before\ngo: svc, err := client.Container().WithExec(...).AsService()\n// after — attach terminal to the container directly\nctr, err := client.Container().From(\"alpine\").WithExec([\"sh\"])\n_, err = ctr.Terminal()","handlingStrategy":"validation","validationCode":"// Prefer terminal on a Container that has a real command, not a bare Service.\nconst ctr = client.container().from(\"alpine\").withExec([\"sh\", \"-c\", \"sleep infinity\"]);\nconst svc = ctr.asService();\n// ensure the container defines an exec process before attaching a service terminal\nif (!ctr.rootfs) throw new Error(\"terminal requires a container with an exec command\");","typeGuard":null,"tryCatchPattern":"try {\n  await svc.terminal();\n} catch (e) {\n  if (String(e).includes(\"does not support terminal\")) {\n    // fall back to terminal on the underlying container\n    await container.terminal();\n  } else throw e;\n}","preventionTips":["Only terminal into services whose container ran a real command (WithExec).","Attach terminals to Containers rather than Services when in doubt.","Avoid creating services purely from port/proxy configuration for terminal use."],"tags":["dagger","terminal","service","exec"],"backgroundTag":"service-has-no-exec-process","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}