vscode-bash-debug icon indicating copy to clipboard operation
vscode-bash-debug copied to clipboard

Error: Reached to unreachable code while validating enviroment

Open MaryamNasr opened this issue 5 years ago • 7 comments

How to reproduce:

  • Install Bash Debug
  • Try Debugging using Bash-Debug

Output:

I get this error:

1

Executables

Bash Debug: 0.3.5

Details

Configurations in launch.json

{
	"type": "bashdb",
	"request": "launch",
	"name": "Bash-Debug (type in script name)",
	"cwd": "${workspaceFolder}",
	"program": "${command:AskForScriptName}",
	"args": []
},
{
	"type": "bashdb",
	"request": "launch",
	"name": "Bash-Debug (select script from list of sh files)",
	"cwd": "${workspaceFolder}",
	"program": "${command:SelectScriptName}",
	"args": []
},
{
	"type": "bashdb",
	"request": "launch",
	"name": "Bash-Debug (hardcoded script name)",
	"cwd": "${workspaceFolder}",
	"program": "${workspaceFolder}/path/to/script.sh",
	"args": []
},

settings.json

{
    "python.pythonPath": "C:\\ProgramData\\Anaconda3\\python.exe",
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
    
}

MaryamNasr avatar Aug 03 '19 12:08 MaryamNasr

Cannot reproduce. Is WSL installed?

rogalmic avatar Aug 13 '19 05:08 rogalmic

I am having the same issue and I have installed WSL.

I am using: -Version: 0.3.6 -Simplest Config.

I get the same error after selecting the Start Debug button.

APNorcross avatar Nov 01 '19 05:11 APNorcross

I have the same problem. Simplest Config. version 0.3.6. WSL is installed

zpittmansf avatar Dec 17 '19 16:12 zpittmansf

I may have a fix/workaround for this. I am not sure why this works but when I tried just running "bash" by itself I got the message: "Windows Subsystem for Linux has no installed distributions. Distributions can be installed by visiting the Microsoft Store: https://aka.ms/wslstore"

Looking further I found articles suggesting to run lxrun /install. After doing that and executing bash I found myself at the bash command prompt.

Now visual studio code bash debug works as expected. I hope this helps.

zpittmansf avatar Dec 17 '19 18:12 zpittmansf

Just encountered this as well, my first time trying this extension with WSL.
Thing is that unlike what @zpittmansf described, bash does work for me, so it seems no special commands are required.
However, the problem still exists, and I can't even find any logs to attach ☹️

MrPointer avatar Nov 18 '20 09:11 MrPointer

Just installed Bash Debug for the first time and created the debug launch.json as specified, and I run into this in a basic Windows 64bit (non-WSL) environment.

Any tips?

jrlanglois avatar Aug 06 '21 18:08 jrlanglois

I had the same problem after installing the bash_debug extension. When I googled for "/bin/ash: bash: not found", I first found this: WSL2: wsl.exe shell not picking up $PATH #4167 That page recommended to search here instead for a solution.

After finding this page, I decided to try what was recommended on the WSL issue page. I checked that my default WSL distribution was "Alpine". I changed it to "Ubuntu". That solved the problem!

[ After switching to Ubuntu, at first I got another error: "Error: BUG: timeout while validating environment.". But stopping the debugger and restarting, that error went away. ]

johnpankowicz avatar May 25 '22 21:05 johnpankowicz