Skip to content

Conversation

@mattnworb
Copy link

@mattnworb mattnworb commented Nov 24, 2025

buildifer allows you to configure defaults by placing a .buildifer.json file at the root of the project.

If this file happens to have

{
  "lint": "fix",
  ...
}

then the extension will run into an error at startup which presents a confusing "Failed to find a Bazel workspace" error dialog to the user. From the Extension Host logs in the Output panel:

2025-11-24 14:49:33.178 [error] Error: Command failed: buildifier --format=json --mode=check
buildifier: --lint=fix is only compatible with --mode=fix

	at genericNodeError (node:internal/errors:983:15)
	at wrappedFn (node:internal/errors:537:14)
	at ChildProcess.exithandler (node:child_process:418:12)
	at ChildProcess.emit (node:events:519:28)
	at maybeClose (node:internal/child_process:1101:16)
	at Socket.<anonymous> (node:internal/child_process:456:11)
	at Socket.emit (node:events:519:28)
	at Pipe.<anonymous> (node:net:346:12)

since the command in buildifer_availability is just to check that buildifier is present and able to return JSON output, the default from the config file can be overridden to prevent this error.

buildifer allows you to configure defaults by placing a
`.buildifer.json` file at the root of the project.

If this file happens to have

```json
{
  "lint": "fix",
  ...
```

then the extension will run into an error at startup which presents a
confusing "Failed to find a Bazel workspace" error dialog to the user.
From the Extension Host logs in the Output panel:

```
2025-11-24 14:49:33.178 [error] Error: Command failed: buildifier --format=json --mode=check
buildifier: --lint=fix is only compatible with --mode=fix

	at genericNodeError (node:internal/errors:983:15)
	at wrappedFn (node:internal/errors:537:14)
	at ChildProcess.exithandler (node:child_process:418:12)
	at ChildProcess.emit (node:events:519:28)
	at maybeClose (node:internal/child_process:1101:16)
	at Socket.<anonymous> (node:internal/child_process:456:11)
	at Socket.emit (node:events:519:28)
	at Pipe.<anonymous> (node:net:346:12)
```

since the command in buildifer_availability is just to check that buildifier is
present and able to return JSON output, the default from the config file can be
overridden to prevent this error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant