vscode-php-debug: XDebugError: command is not available
PHP version: 7.2.8 XDebug version: 2.6.1 Adapter version: 1.12.6
launch.json:
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9001,
"pathMappings": {
"/srv/www": "${workspaceRoot}/api/app"
},
"ignore": ["**/vendor/**/*.php"],
"log": true
}
XDebug php.ini config:
; Disable Error and Exception modifications
xdebug.show_error_trace=0
xdebug.show_exception_trace=0
; General
xdebug.idekey="api-php"
; Profiling
xdebug.profiler_enable=0
; Remote
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_handler="dbgp"
xdebug.remote_port=9001
; xdebug.remote_connect_back=1
xdebug.remote_host="docker.for.mac.localhost"
xdebug.remote_log="/var/log/php/xdebug.log"
Error from adapter log:
XDebugError: command is not available at new Response (/Users/jacob/.vscode/extensions/felixfbecker.php-debug-1.12.6/out/xdebugConnection.js:56:19) at Connection.<anonymous> (/Users/jacob/.vscode/extensions/felixfbecker.php-debug-1.12.6/out/xdebugConnection.js:611:20) at Generator.next (<anonymous>) at fulfilled (/Users/jacob/.vscode/extensions/felixfbecker.php-debug-1.12.6/out/xdebugConnection.js:4:58) at <anonymous> code: 5, name: ‘XDebugError’
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (1 by maintainers)
Hello there, I seem to be having a very similar issue. The debug console is overloaded with messages like this while the debugger seem to work perfectly fine:
{ XDebugError: command is not available at new Response (/home/user/.vscode-server/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:56:19) at Connection.<anonymous> (/home/user/.vscode-server/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:611:20) at Generator.next (<anonymous>) at fulfilled (/home/user/.vscode-server/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:4:58) at process._tickCallback (internal/process/next_tick.js:68:7) code: 5, name: 'XDebugError' }
This practically renders the debug console useless, i think that this kind of messages and errors should be on the output tab instead of on the console one.
Setting path mappings for all the projects that are interconnected on my dev machine using the ssh approach makes little to no sense if as by the previous comments this is related.
Should i provide any further logs or insight, please tell me and i will try my best to provide them
Anyone solved it? I have the same issue
I am not sure why this resolved the issue:
Issue was resolved. Thanks @anonymous-explorer for the tip.
In my case I had only the simplest configuration:
My solution was to create a workspace for my project 😃
Got it working using
"pathMappings": { "/var/www/html/web": "${workspaceRoot}" }
in my launch.jsonfingers crossed it continues to work!
After all, we are working with digital computers: either it does work (1) or it doesn’t work (0) - right folks?! And they don’t have “off-days” either - switch 'em on and off we go, right?! yeah?
@oojacoboo’s comment above about stopOnEntry: true was helpful as like them, for me it also helped me understand what was going wrong
https://github.com/felixfbecker/vscode-php-debug/issues/321#issuecomment-441518110
(the original error - “command not available” / “command not found” is f*cking useless - I mean WHAT command?!)
With stopOnEntry in my launch.json, I was able to see that xdebug/vscode could not open a file
My launch.json looks like this:
Also important to note relative locations of files - I feel this is crucial:
I have a top-level folder,
gmb-develop
within which everything underneath it is under git control. (The git bit isn’t really relevant here but just for context)Then I have a web folder, which is my docroot for my web application - Drupal 7 (php).
And my
launch.json
(shown above) is in the web folder in a folder called.vscode
So the path of my launch.json is:gmb-develop/web/.vscode/launch.json
So the location of my launch.json is interdependent with “pathMappings”: { “/var/www/html/web”: “${workspaceRoot}” } setting within it.
According to https://code.visualstudio.com/docs/editor/variables-reference though, ${workspaceRoot} is deprecated and ${workspaceFolder} takes its place. So I will try that ${workspaceFolder} next and update
Also - this is good to know: https://code.visualstudio.com/docs/editor/variables-reference#_how-can-i-know-a-variables-actual-value
Here’s my screenshot of my setup working whereby the breakpoint has been hit:
And here’s that more useful error that helped me (based on @oojacoboo’s advice about
"stopOnEntry": true
, inlaunch.json
:Here’s another screenshot showing my top level folder / “workspace” as being web - important to know in terms of the relative location of .vscode/launch.json Note that this .vscode/launch.json is a subfolder off of web top level folder.
and here’s another screenshot showing the launch.json
Hope this help folks get xdebug running properly. Let’s smack these problems down and stamp them out; who wants to debug their debugging setup, when they actually want to get the hell on with developing. And who wants to use sh*tty print_r, vardump and all that f*cking tin-pot cr*p either!!! Life really is too short… and it’s sunny outside, I’d rather spend time out there than in here having my life stole away debugging my own debugging setup.
My setup is ddev for local development on Ubuntu 20.04
I saw this error after I disabled PHP Intellisense plugin in VS Code. I had both PHP Intellisense and PHP Intellephense plugins enabled, so I decided to disable Intellisense. After I re-enabled Intellisense the error is gone.
So, I was able to resolve this issue actually. I was able to get an error by enabling the
"stopOnEntry": true,
setting which tipped me off that thepathMappings
value wasn’t correct.It’s worth nothing that the variable,
${workspaceRoot}
, is confusing if you have multiple “projects” within your “workspace”. If so, the project directories aren’t considered part of the path for the mappings.Regardless of this, I still think the error should be addressed. It’s seems unlikely that a
command is not available
error is okay under any condition.Yes, I found after trying that @zer0pants’ solution did not work for me! So still open on my side as well.
This pointed me in the right direction. I have
Foo
andBar
“folders” within my workspace, which generate this error. This fixed the issue :A note should probably be added to the README doc.
Same here
XDebugError: command is not available at new Response (/home/giuseppe/.vscode/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:56:19) at new BreakpointSetResponse (/home/giuseppe/.vscode/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:207:9) at Connection.<anonymous> (/home/giuseppe/.vscode/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:599:20) at Generator.next (<anonymous>) at fulfilled (/home/giuseppe/.vscode/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:4:58) { code: 5, name: ‘XDebugError’ } Error applying xdebugSettings: command is not available