Khắc phục lỗi the handle is invalid c++ năm 2024

Just installed from chocolatey on Windows 10, now when I try to to add a new profile using aws-vault add, it fails after I provide the access key. See output below:

$ aws-vault add alisson --debug
2021/04/23 19:31:40 aws-vault v6.3.1
2021/04/23 19:31:40 [keyring] Considering backends: [wincred]
2021/04/23 19:31:40 Loading config file C:\Users\siri\.aws\config
2021/04/23 19:31:40 Parsing config file C:\Users\siri\.aws\config
Enter Access Key ID: [my actual key from my IAM User]
Enter Secret Access Key: aws-vault: error: add: The handle is invalid.

Seems like this is an old bug, there was a merge request, but seems like it's still not fixed:

112

113

The text was updated successfully, but these errors were encountered:

As a sidenote, I was able to add my profile using PowerShell, but then from powershell it's not possible to run aws-vault exec, error below:

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

I added the aws-vault.exe folder path to the $PATH environment variable for system, it still failed with same issue. Then I added to my user $PATH env variable, still no luck.

Khắc phục lỗi the handle is invalid c++ năm 2024

Funny thing is that aws-vault exec works fine in Git Bash. So basically I had to use PowerShell for adding the profile, but Git Bash to actually generate the session using aws-vault exec.

In the output of

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

0 it says:

usage: aws-vault exec []  [] [...]
...  ...
Args:
    Name of the profile
  []    Command to execute, defaults to $SHELL
  []   Command arguments

When you run

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

1 you're providing the profile but not the command to run, so

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

2 is defaulting to trying to run whatever is stored in

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

3. I'd guess your PowerShell shell doesn't have that env var defined (or it's defined as an empty value) and so it gets an error when trying to invoke an empty string as a command. It works in Git Bash because

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

3 is defined there.

@irgeek thanks for your reply. So it seems like for it to work in PowerShell we'd need to first declare a $SHELL env var.

What about aws-vault add failing in Git Bash? That one seems even more confusing (the handle is invalid).

So it seems like for it to work in PowerShell we'd need to first declare a $SHELL env var.

You don't need

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

3 defined in your environment, you just need to provide a command. Instead of

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

1 you can just do

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

8 and the AWS CLI should run. The dropping into a new shell thing is convenient occasionally, but for the most part I don't use it.

What about aws-vault add failing in Git Bash? That one seems even more confusing (the handle is invalid).

That's a Windows error. I'd guess it has something to do with the way

PS C:\WINDOWS\system32> aws-vault exec alisson
aws-vault: error: exec: Error execing process: Failed to start command: exec: "": executable file not found in %PATH%
PS C:\WINDOWS\system32>

2 is trying to manipulate the TTY it's attached to, possibly to hide the secret key when it's entered. But as I said, that's a guess-I have no clue how to fix it.

I believe

usage: aws-vault exec []  [] [...]
...  ...
Args:
    Name of the profile
  []    Command to execute, defaults to $SHELL
  []   Command arguments

0 may well get you out of trouble in Git Bash.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.