{"record":{"id":"a134233bb32b0073","repo":"hashicorp/nomad","slug":"failed-to-start-command-v","errorCode":null,"errorMessage":"failed to start command: %v","messagePattern":"failed to start command: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/shared/executor/exec_utils.go","lineNumber":59,"sourceCode":"func (e *execHelper) run(ctx context.Context, tty bool, stream drivers.ExecTaskStream) error {\n\tif tty {\n\t\treturn e.runTTY(ctx, stream)\n\t}\n\treturn e.runNoTTY(ctx, stream)\n}\n\nfunc (e *execHelper) runTTY(ctx context.Context, stream drivers.ExecTaskStream) error {\n\tptyF, tty, err := e.newTerminal()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open a tty: %v\", err)\n\t}\n\tdefer tty.Close()\n\n\tif err := e.setTTY(tty); err != nil {\n\t\treturn fmt.Errorf(\"failed to set command tty: %v\", err)\n\t}\n\tif err := e.processStart(); err != nil {\n\t\treturn fmt.Errorf(\"failed to start command: %v\", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\terrCh := make(chan error, 3)\n\n\tpty, err := ptyF()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get pty: %v\", err)\n\t}\n\n\tdefer pty.Close()\n\twg.Add(1)\n\tgo handleStdin(e.logger, pty, stream, errCh)\n\t// when tty is on, stdout and stderr point to the same pty so only read once\n\tgo handleStdout(e.logger, pty, &wg, stream.Send, errCh)\n\n\tps, err := e.processWait()\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/shared/executor/exec_utils.go#L41-L77","documentation":"UniversalExecutor.runTTY wraps any failure from e.processStart() (which calls the underlying exec.Cmd Start) with this message. It means the command binary could not be started after the TTY was configured. The wrapped error from the OS/exec package carries the real cause.","triggerScenarios":"runTTY is invoked via run() with command.Tty enabled, and processStart returns an error from cmd.Start — e.g. binary not found, exec format error, fork/exec permission denied, or resource limits.","commonSituations":"Typo in driver command path (task driver config 'command'), missing binary inside a chroot/task dir, non-executable file, incompatible architecture binary (exec format error), PID/file-descriptor limits exhausted.","solutions":["Check the wrapped %v cause: 'no such file or directory' means fix the command path in the task config","Verify the binary exists and is executable inside the task environment (chmod +x, correct chroot/image)","Confirm binary architecture matches the host (exec format error)","Check ulimits (nproc) and cgroup PID limits on the host","Run the same command manually as the nomad user to reproduce"],"exampleFix":"// before\ncommand = \"myapp-binary\" // not present in task dir\n// after\ncommand = \"/usr/local/bin/myapp\" // absolute path to an existing executable","handlingStrategy":"validation","validationCode":"func validateCommand(path string) error {\n  fi, err := os.Stat(path)\n  if err != nil { return fmt.Errorf(\"command not found: %w\", err) }\n  if fi.IsDir() || fi.Mode()&0o111 == 0 { return fmt.Errorf(\"%s is not executable\", path) }\n  return nil\n}","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(cmd, args...).CombinedOutput()\nif err != nil && strings.Contains(err.Error(), \"failed to start command\") {\n  // inspect wrapped cause: ENOENT/EACCES/ENOEXEC\n  log.Printf(\"task launch failed, command=%s: %v\", cmd, err)\n}","preventionTips":["Use absolute paths for driver 'command' config","Pre-download artifacts and chmod +x before launch","Pin binary architecture to the host platform","Monitor client fd/pid limits"],"tags":["process-start","exec","tty","nomad-executor"],"backgroundTag":"exec-command-not-found","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"}