{"record":{"id":"4571a98c9a317485","repo":"wavetermdev/waveterm","slug":"cannot-start-job-manager-w","errorCode":null,"errorMessage":"cannot start job manager: %w","messagePattern":"cannot start job manager: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshremote/wshremote_job.go","lineNumber":172,"sourceCode":"\t\tcmd.Env = append(os.Environ(), \"WAVETERM_PUBLICKEY=\"+data.PublicKeyBase64)\n\t}\n\tcmd.ExtraFiles = []*os.File{readyPipeWrite}\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create stdin pipe: %w\", err)\n\t}\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create stdout pipe: %w\", err)\n\t}\n\tstderr, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create stderr pipe: %w\", err)\n\t}\n\tlog.Printf(\"RemoteStartJobCommand: created pipes\\n\")\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot start job manager: %w\", err)\n\t}\n\treadyPipeWrite.Close()\n\tlog.Printf(\"RemoteStartJobCommand: job manager process started\\n\")\n\n\tjobAuthTokenLine := fmt.Sprintf(\"Wave-JobAccessToken:%s\\n\", data.JobAuthToken)\n\tif _, err := stdin.Write([]byte(jobAuthTokenLine)); err != nil {\n\t\tcmd.Process.Kill()\n\t\treturn nil, fmt.Errorf(\"cannot write job auth token: %w\", err)\n\t}\n\tstdin.Close()\n\tlog.Printf(\"RemoteStartJobCommand: wrote auth token to stdin\\n\")\n\n\tgo func() {\n\t\tscanner := bufio.NewScanner(stderr)\n\t\tfor scanner.Scan() {\n\t\t\tline := scanner.Text()\n\t\t\tlog.Printf(\"RemoteStartJobCommand: stderr: %s\\n\", line)\n\t\t}","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshremote/wshremote_job.go#L154-L190","documentation":"cmd.Start() failed to launch the 'wsh jobmanager --jobid ... --clientid ...' child process. The error from os/exec (typically exec.ErrNotFound wrapped as 'exec: \"wsh\": executable file not found in $PATH', or a permission error) is wrapped with %w.","triggerScenarios":"The resolved wshPath from getWshPath() points to a missing, deleted, or non-executable binary; the binary exists but lacks +x; or the filesystem housing it is unavailable.","commonSituations":"Wave not fully installed / wsh binary not installed on the remote host; PATH differences between server env and expected install location; binary removed by cleanup or an upgrade; noexec mount on the install directory.","solutions":["Run 'wsh init' / reinstall the wsh binary on the remote host so getWshPath() resolves a valid executable","Check permissions: chmod +x on the wsh binary and verify the path it resolves to","Verify the install filesystem is mounted and not noexec","Reproduce by running the resolved wshPath manually with the jobmanager args"],"exampleFix":"// before\n$ ls $(which wsh)\nwhich: no wsh in (...)\n// after\n$ wsh init   # install the wsh binary on the remote host\n$ chmod +x ~/.local/bin/wsh","handlingStrategy":"validation","validationCode":"wshPath, err := getWshPath() // or replicate: exec.LookPath(\"wsh\")\nif err != nil {\n    return fmt.Errorf(\"wsh binary not available: %w\", err)\n}\nif info, err := os.Stat(wshPath); err != nil || info.Mode()&0o111 == 0 {\n    return fmt.Errorf(\"wsh binary missing or not executable: %s\", wshPath)\n}","typeGuard":"func wshExecutableAvailable(path string) bool {\n    info, err := os.Stat(path)\n    return err == nil && !info.IsDir() && info.Mode()&0o111 != 0\n}","tryCatchPattern":"rtn, err := server.RemoteStartJobCommand(ctx, data)\nif err != nil {\n    if strings.Contains(err.Error(), \"cannot start job manager\") {\n        // reinstall wsh on the remote ('wsh init') and retry once\n    }\n    return err\n}","preventionTips":["Run 'wsh init' on every remote host before using jobs","Verify the binary is executable and on the expected path","Reinstall wsh after Wave upgrades to keep versions in sync"],"tags":["exec","process","binary-not-found","permissions"],"backgroundTag":"executable-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}