web-ext icon indicating copy to clipboard operation
web-ext copied to clipboard

`web-ext run --firefox-binary /bin/librewolf --verbose` fails to load addon with `connection error: Error: connect ECONNREFUSED 127.0.0.1:38085`

Open hueychen27 opened this issue 5 months ago • 8 comments

When running web-ext run --firefox-binary /bin/librewolf --verbose, I get:

[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (0); connection error: Error: connect ECONNREFUSED 127.0.0.1:38085
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 38085
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (1); connection error: Error: connect ECONNREFUSED 127.0.0.1:38085
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 38085
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (2); connection error: Error: connect ECONNREFUSED 127.0.0.1:38085
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 38085
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (3); connection error: Error: connect ECONNREFUSED 127.0.0.1:38085
...
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connect to Firefox debugger: too many retries
[/usr/local/lib/node_modules/web-ext/lib/program.js][error] 
Error: connect ECONNREFUSED 127.0.0.1:38085
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1628:16)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17)

[/usr/local/lib/node_modules/web-ext/lib/program.js][error] Error code: ECONNREFUSED

[/usr/local/lib/node_modules/web-ext/lib/program.js][debug] Command executed: run

After a while, Librewolf closes when the final message of too many retries is received.

EDIT: Executing web-ext run --verbose --pref="browser.dom.window.dump.enabled=true" --pref="devtools.console.stdout.chrome=true" --pref="devtools.debugger.log=true" --firefox-binary /bin/librewolf as suggested by @rpl:

[/usr/local/lib/node_modules/web-ext/lib/program.js][info] Version:
[/usr/local/lib/node_modules/web-ext/lib/program.js][debug] Discovering config files. Set --no-config-discovery to disable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/.web-ext-config.mjs" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/package.json" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/web-ext-config.cjs" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/.web-ext-config.js" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/.web-ext-config.cjs" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/web-ext-config.mjs" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/web-ext-config.js" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/.web-ext-config.mjs" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/.web-ext-config.js" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/config.js][debug] Discovered config "[redacted]/.web-ext-config.cjs" does not exist or is not readable
[/usr/local/lib/node_modules/web-ext/lib/cmd/run.js][info] Running web extension from [redacted]
[/usr/local/lib/node_modules/web-ext/lib/util/manifest.js][debug] Validating manifest at [redacted]/manifest.json
[/usr/local/lib/node_modules/web-ext/lib/extension-runners/firefox-desktop.js][debug] Creating new Firefox profile
[/usr/local/lib/node_modules/web-ext/lib/firefox/index.js][info] Setting custom Firefox preferences: {
  "browser.dom.window.dump.enabled": true,
  "devtools.console.stdout.chrome": true,
  "devtools.debugger.log": true
}
[/usr/local/lib/node_modules/web-ext/lib/firefox/index.js][debug] Running Firefox with profile at /tmp/user/1000/firefox-profileijSUJg/
[/usr/local/lib/node_modules/web-ext/lib/firefox/index.js][debug] Executing Firefox binary: /bin/librewolf
[/usr/local/lib/node_modules/web-ext/lib/firefox/index.js][debug] Firefox args: -start-debugger-server 40057 -foreground -no-remote -profile /tmp/user/1000/firefox-profileijSUJg/
[/usr/local/lib/node_modules/web-ext/lib/firefox/index.js][info] Use --verbose or --devtools to see logging
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to the remote Firefox debugger
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (0); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (1); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (2); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (3); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057

...

[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (244); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (245); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (246); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (247); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (248); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (249); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connecting to Firefox on port 40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (250); connection error: Error: connect ECONNREFUSED 127.0.0.1:40057
[/usr/local/lib/node_modules/web-ext/lib/firefox/remote.js][debug] Connect to Firefox debugger: too many retries
[/usr/local/lib/node_modules/web-ext/lib/program.js][error] 
Error: connect ECONNREFUSED 127.0.0.1:40057
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1628:16)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17)

[/usr/local/lib/node_modules/web-ext/lib/program.js][error] Error code: ECONNREFUSED

[/usr/local/lib/node_modules/web-ext/lib/program.js][debug] Command executed: run

hueychen27 avatar Jul 19 '25 20:07 hueychen27

@hueychen27 we are not sure if librewolf have made any change to the command line options that could prevent it from listening on the port that gets passed to it.

The issue may be more likely on the fx-runner side (which is used by web-ext to run Firefox and pass the option to make the remote debugging protocol server to start automatically on the given tcp port), you may try to use fx-runner binary directly and the --listen option with librewolf and double-check if it is listening on the TCP port or if any error has been logged in the librewolf browser console:

  • https://github.com/mozilla/node-fx-runner/
  • https://www.npmjs.com/package/fx-runner

Librewolf is an independent Firefox fork and so we are not sure which changes they may have applied (nor which version of Firefox upstream version they are based on) and so you'll need to investigate it further.

rpl avatar Jul 31 '25 12:07 rpl

@rpl What is expected to happen as I debug?

hueychen27 avatar Aug 01 '25 23:08 hueychen27

@rpl What is expected to happen as I debug?

@hueychen27 actually try out this additional web-ext run options to set prefs that should make librewolf remote debugger server to emit logs to state that is listing on the given port:

web-ext run --verbose --pref="browser.dom.window.dump.enabled=true" --pref="devtools.console.stdout.chrome=true" --pref="devtools.debugger.log=true" --firefox-binary /bin/librewolf

and then attach to this bug the resulting verbose logs so that we can see if we can gather any additional thoughts about what may not be working for librewolf.

rpl avatar Aug 14 '25 12:08 rpl

I'm wondering whether it may be due to Librewolf's use of autoconfig.

Librewolf sets devtools.debugger.remote-enabled to false at https://codeberg.org/librewolf/settings/src/commit/a57df0234fe5e0c6af00d07d71de062c85010521/librewolf.cfg#L483

pref("devtools.debugger.remote-enabled", false); // default, but subject to branding so keep it

web-ext sets devtools.debugger.remote-enabled to true via user.js, but it seems that autoconfig would override it.

Rob--W avatar Aug 14 '25 13:08 Rob--W

@rpl Done.

hueychen27 avatar Aug 16 '25 21:08 hueychen27

@hueychen27 thanks, unfortunately the logs that librewolf emitted doesn't show any additional detail that would help us to determine the underlying issue.

Nonetheless, what @Rob--W mentioned in https://github.com/mozilla/web-ext/issues/3473#issuecomment-3188543244 seems a very likely reason for the remote debugging protocol not being enabled when the pref is flipped for librewolf.

The best path forward is likely to report the issue to librewolf issue tracker to gather their perspective and ideas about how that could be solved.

We will keep this issue open for now, so that we can determine if what is gathered from the librewolf issue may provide a reasonable way to make web-ext to work with it.

rpl avatar Aug 28 '25 12:08 rpl

The best path forward is likely to report the issue to librewolf issue tracker

It looks like this was filed at https://codeberg.org/librewolf/issues/issues/2656

alxndrsn avatar Nov 10 '25 11:11 alxndrsn

It looks like this was filed at https://codeberg.org/librewolf/issues/issues/2656

That's me; still no response yet.

hueychen27 avatar Nov 11 '25 04:11 hueychen27