{"record":{"id":"5a4047ecf3bef427","repo":"hashicorp/nomad","slug":"failed-to-launch-command-with-executor-v","errorCode":null,"errorMessage":"failed to launch command with executor: %v","messagePattern":"failed to launch command with executor: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/exec/driver.go","lineNumber":546,"sourceCode":"\t\tUser:             user,\n\t\tResourceLimits:   true,\n\t\tNoPivotRoot:      d.config.NoPivotRoot,\n\t\tResources:        cfg.Resources,\n\t\tTaskDir:          cfg.TaskDir().Dir,\n\t\tWorkDir:          driverConfig.WorkDir,\n\t\tStdoutPath:       cfg.StdoutPath,\n\t\tStderrPath:       cfg.StderrPath,\n\t\tMounts:           cfg.Mounts,\n\t\tDevices:          cfg.Devices,\n\t\tNetworkIsolation: cfg.NetworkIsolation,\n\t\tModePID:          executor.IsolationMode(d.config.DefaultModePID, driverConfig.ModePID),\n\t\tModeIPC:          executor.IsolationMode(d.config.DefaultModeIPC, driverConfig.ModeIPC),\n\t\tCapabilities:     caps,\n\t}\n\n\tps, err := exec.Launch(execCmd)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to launch command with executor: %v\", err)\n\t}\n\n\th := &taskHandle{\n\t\texec:         exec,\n\t\tpid:          ps.Pid,\n\t\tpluginClient: pluginClient,\n\t\ttaskConfig:   cfg,\n\t\tprocState:    drivers.TaskStateRunning,\n\t\tstartedAt:    time.Now().Round(time.Millisecond),\n\t\tlogger:       d.logger,\n\t}\n\n\tdriverState := TaskState{\n\t\tReattachConfig: pstructs.ReattachConfigFromGoPlugin(pluginClient.ReattachConfig()),\n\t\tPid:            ps.Pid,\n\t\tTaskConfig:     cfg,\n\t\tStartedAt:      h.startedAt,\n\t}","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/exec/driver.go#L528-L564","documentation":"StartTask builds the executor command (with isolation settings, capabilities, mounts) and calls exec.Launch to run the user process under the executor. Any failure from Launch — the command not found, chroot/isolation setup errors, cgroup creation failure — is wrapped as this error.","triggerScenarios":"exec.Launch(execCmd) returns error: task command binary missing inside the chroot, isolation (chroot/cgroups) setup failed, capabilities cannot be applied, or the user cannot exec the command.","commonSituations":"command path not present in the chroot (not in the mounted whitelist); missing shared libraries in chroot; cgroups v1/v2 misconfiguration; cap_add beyond allowed set rejected at exec time.","solutions":["Confirm the command exists inside the chroot; add required paths via the task's 'mount' blocks or use absolute paths.","Run 'nomad alloc status <id>' and client logs for the executor's underlying error.","Verify cgroups are mounted and writable (both v1 and v2 layouts per OS).","Ensure the binary is statically linked or its libraries are available in the chroot (e.g., ldd the binary).","Check the requested capabilities match what the client's allow_caps permits."],"exampleFix":"// before\nconfig {\n  command = \"/opt/app/server\" // not in chroot\n}\n// after\nconfig {\n  command = \"/usr/local/bin/server\"\n  mounts = [{ host_path = \"/opt/app\", task_path = \"/opt/app\" }]\n}","handlingStrategy":"validation","validationCode":"// verify the command exists and is executable in the chroot before launch\np := filepath.Join(chrootDir, command)\nif fi, err := os.Stat(p); err != nil || fi.IsDir() || fi.Mode()&0o111 == 0 {\n    return fmt.Errorf(\"command %s missing or not executable in chroot\", command)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute command paths and verify they exist inside the chroot whitelist.","Mount required libraries/dirs (ldd your binary) or use static binaries.","Confirm cgroups are mounted and writable for the nomad user.","Smoke-test task configs on a staging client with identical isolation settings."],"tags":["nomad","exec-driver","chroot","isolation","process-launch"],"backgroundTag":"command-launch-failed","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"}