{"record":{"id":"a03ffc472231cdcc","repo":"hashicorp/nomad","slug":"task-driver-does-not-support-exec","errorCode":null,"errorMessage":"task driver does not support exec","messagePattern":"task driver does not support exec","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/driver_handle.go","lineNumber":97,"sourceCode":"}\n\n// ExecStreaming is the handled used by client endpoint handler to invoke the appropriate task driver exec.\n// while allowing to stream input and output\nfunc (h *DriverHandle) ExecStreaming(ctx context.Context,\n\tcommand []string,\n\ttty bool,\n\tstream drivers.ExecTaskStream) error {\n\tif h == nil {\n\t\treturn te.ErrTaskNotRunning\n\t}\n\n\tif impl, ok := h.driver.(drivers.ExecTaskStreamingRawDriver); ok {\n\t\treturn impl.ExecTaskStreamingRaw(ctx, h.taskID, command, tty, stream)\n\t}\n\n\td, ok := h.driver.(drivers.ExecTaskStreamingDriver)\n\tif !ok {\n\t\treturn fmt.Errorf(\"task driver does not support exec\")\n\t}\n\n\texecOpts, doneCh := drivers.StreamToExecOptions(\n\t\tctx, command, tty, stream)\n\n\tresult, err := d.ExecTaskStreaming(ctx, h.taskID, execOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texecOpts.Stdout.Close()\n\texecOpts.Stderr.Close()\n\n\tselect {\n\tcase err = <-doneCh:\n\tcase <-ctx.Done():\n\t\terr = fmt.Errorf(\"exec task timed out: %v\", ctx.Err())\n\t}","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/driver_handle.go#L79-L115","documentation":"DriverHandle.ExecStreaming first checks whether the task driver implements drivers.ExecTaskStreamingRawDriver, then drivers.ExecTaskStreamingDriver. If the driver implements neither interface, it cannot stream exec sessions into the running task and returns this plain error.","triggerScenarios":"Calling AllocExec / task exec streaming against a task whose driver only implements the basic drivers.TaskDriver interface (no exec streaming capability), e.g. exec'ing into a container with a driver that lacks exec support.","commonSituations":"Using 'nomad alloc exec' on a driver such as java, qemu, or a custom/3rd-party driver that does not implement ExecTaskStreaming; exec on a driver whose exec support was never implemented; calling the API programmatically against such a driver.","solutions":["Use a driver that supports exec (e.g. exec, docker) for workloads you need to exec into","Check driver capabilities via fingerprinting before offering exec in tooling","For raw streaming needs, ensure the driver implements ExecTaskStreamingRawDriver","Fall back to driver-specific debugging (logs) instead of exec"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// check driver capabilities before attempting exec\ndriverInfo, err := client.Nodes().Driver(nodeID, driverName, nil)\nif err != nil || driverInfo == nil || !driverInfo.Detected {\n    return fmt.Errorf(\"driver %s unavailable for exec\", driverName)\n}","typeGuard":"func supportsExec(d drivers.DriverPlugin) bool {\n    _, basic := d.(drivers.ExecTaskStreamingDriver)\n    _, raw := d.(drivers.ExecTaskStreamingRawDriver)\n    return basic || raw\n}","tryCatchPattern":"if err := handle.ExecStreaming(ctx, cmd, tty, stream); err != nil {\n    if strings.Contains(err.Error(), \"does not support exec\") {\n        return fmt.Errorf(\"driver %T has no exec support; use logs or a different driver\", handle.driver)\n    }\n    return err\n}","preventionTips":["Use exec/docker drivers when interactive exec is required","Gate exec UI features on driver capability discovery","Document per-driver exec support for operators","Test driver capability changes after Nomad upgrades"],"tags":["exec","drivers","streaming"],"backgroundTag":"operation-not-supported","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}