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:

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