Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel queries fail after first bazel build #223

Closed
warriorstar-orion opened this issue Nov 18, 2020 · 7 comments
Closed

Bazel queries fail after first bazel build #223

warriorstar-orion opened this issue Nov 18, 2020 · 7 comments
Assignees

Comments

@warriorstar-orion
Copy link

Hello, thank you for all your hard work.

Pertinent info:

$ code --version
1.51.1
e5a624b788d92b8d34d1392e4c4d9789406efe8f
x64

$ code --list-extensions --show-versions
BazelBuild.vscode-bazel@0.4.0
be5invis.toml@0.5.1
bungcip.better-toml@0.3.2
casualjim.gotemplate@0.4.0
fcrespo82.markdown-table-formatter@2.1.3
gbasood.byond-dm-language-support@1.0.1
golang.go@0.18.1
jbockle.jbockle-format-files@3.0.0
lonefy.vscode-JS-CSS-HTML-formatter@0.2.3
ms-vscode-remote.remote-containers@0.148.1
ms-vscode-remote.remote-ssh@0.56.0
ms-vscode-remote.remote-ssh-edit@0.56.0
ms-vscode-remote.remote-wsl@0.51.3
ms-vscode-remote.vscode-remote-extensionpack@0.20.0
ms-vscode.cpptools@1.1.2
redhat.java@0.70.0
Stephanvs.dot@0.0.1
stkb.rewrap@1.13.0
thesofakillers.vscode-pbtxt@0.0.3
tintinweb.graphviz-interactive-preview@0.0.9
VisualStudioExptTeam.vscodeintellicode@1.2.10
vscjava.vscode-java-debug@0.29.0
vscjava.vscode-java-dependency@0.14.0
vscjava.vscode-java-pack@0.10.0
vscjava.vscode-java-test@0.26.0
vscjava.vscode-maven@0.25.0
vscodevim.vim@1.17.1
wayou.vscode-todo-highlight@1.0.4
xaver.clang-format@1.9.0
zxh404.vscode-proto3@0.5.2

% uname -a
Darwin eikthyrnir.local 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64

% bazel --version
bazel 3.7.0-homebrew

I believe this is a minimum reproduction example: https://github.com/warriorstar-orion/bugs_vscode_bazelbuild_queryfailure

  1. Clone repro repo. Do not run any bazel commands yet!
  2. code .
  3. ⌘P BUILD ↵
  4. ⌘⇧P Bazel: Build Target ↵
    At this point, the target //:main should now be in the command palette dropdown list. Press .
  5. The bazel Terminal should be selected, with a successful bazel build displayed.
  6. Repeat step 3.
    This time, instead of suggesting the target, an error occurs:
Command 'Bazel: Build Target' resulted in an error (Command failed: /usr/local/bin/bazel --output_base=/var/folders/mh/x76pfqyn4pl55v0yx9vl5bxw0000gn/T/765b26eaf589953e453ebb38850465f7 query kind('.* rule', ...) --output=proto Loading: 0 packages loaded ERROR: error loading package 'bazel-test_workspace/external/bazel_tools/third_party/def_parser': Label '//tools/python:private/defs.bzl' is invalid because 'tools/python' is not a package; perhaps you meant to put the colon here: '//:tools/python/private/defs.bzl'? Loading: 6 packages loaded currently loading: bazel-test_workspace/external/local_config_cc ... (4 packages) Loading: 6 packages loaded currently loading: bazel-test_workspace/external/local_config_cc ... (4 packages) )

Removing bazel-* from the workspace will cause the query to succeed. My first hunch was that VSCode was trying to build something in them unintentionally, but the following settings failed to help:

{
  "bazel.pathsToIgnore": [
    "bazel-bin",
    "bazel-out",
    "bazel-test_workspace",
    "bazel-testlogs"
  ]
}
@kylecordes
Copy link

Same scenario, same error here.

@jinfwhuang
Copy link

I am seeing a similar issue

@lorenz
Copy link

lorenz commented Feb 12, 2021

As a workaround you can set "bazel.queriesShareServer": true` in your settings.json. The issue stems from the extension setting a custom output_base which Bazel chokes on. Setting this option reuses the existing output_base which works fine.

@siedentop
Copy link

@allevato or @philwo could you (or any other contributor) please take a look? (I pinged you because you have the most commits and the most recent commits, respectively.)

Many thanks for the extension and for hopefully taking a look.

@philwo
Copy link
Contributor

philwo commented Aug 10, 2021

@coeuvre Could you have a look at this one, when you have time? 😊

@vorburger
Copy link

See also #216 & #261.

@cameron-martin
Copy link
Collaborator

Duplicate of #216

@cameron-martin cameron-martin marked this as a duplicate of #216 Jan 23, 2024
@cameron-martin cameron-martin closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2024
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

No branches or pull requests

9 participants