Calling vault from golang os.exec fails

I’m trying to call the vault executable from inside a golang program and attempting to make the call returns a 127 error code. I am specifying the full path and the vault CLI is executable. When I change the golang exec to call something else like “ls” it works just fine.

Here is the code and example:

[opc@ecal-helper-prod bash-test]$ pwd
[opc@ecal-helper-prod bash-test]$ ls -al
total 129188
drwxrwxr-x.  2 opc opc        36 Jan 31 16:58 .
drwx------. 17 opc opc      4096 Jan 31 16:58 ..
-rw-rw-r--.  1 opc opc       264 Jan 31 16:58 tester.go
-rwxrwxr-x.  1 opc opc 132277438 Jan 31 16:57 vault
[opc@ecal-helper-prod bash-test]$ cat tester.go
package main

import (

func main() {

    stdout, err := exec.Command("/bin/bash", "-c", "/home/opc/bash-test/vault").CombinedOutput()
    if err != nil {


[opc@ecal-helper-prod bash-test]$ go run tester.go
exit status 127
[opc@ecal-helper-prod bash-test]$

Any ideas on what could be wrong? Is there something special about the vault CLI that prevents it from being callable from inside go?

Thanks in advance for any ideas.

No, it should work fine - you shouldn’t need to involve bash either. How about if you give an argument, like (“vault”, “status”)?

That worked! I could have sworn I tried that before but I guess not. Thank you!