bazelbuild/vscode-bazel

Builds using command line but not inside vscode

kanelbulle opened this issue · 4 comments

  1. Try building inside vscode, get following error:
    Command failed: bazel --output_base=/var/folders/k6/dhwsbs6n3nvfxf6n9yshj7km0000gn/T/0463e4baa7045b5c54bb24e8f17c257b query ...:* --output=package Loading: 0 packages loaded ERROR: error loading package '': at /private/var/folders/k6/dhwsbs6n3nvfxf6n9yshj7km0000gn/T/0463e4baa7045b5c54bb24e8f17c257b/external/io_bazel_rules_kotlin/kotlin/core.bzl:2:5: at /private/var/folders/k6/dhwsbs6n3nvfxf6n9yshj7km0000gn/T/0463e4baa7045b5c54bb24e8f17c257b/external/io_bazel_rules_kotlin/kotlin/internal/opts.bzl:22:5: Every .bzl file must have a corresponding package, but '@io_bazel_rules_kotlin_configured//jvm:opts.bzl' does not have one. Please create a BUILD file in the same or any parent directory. Note that this BUILD file does not need to do anything except exist. Loading: 0 packages loaded Loading: 0 packages loaded
  2. Building using command line works fine without errors: bazel build :raycer
  3. bazel clean etc makes no difference.
    project.zip

I'm experiencing the same.

Command failed: bazel --output_base=/tmp/eab0d61a99b6696edb3d2aff87b585e8 query ...:* --output=package
Loading: 0 packages loaded
DEBUG: /tmp/eab0d61a99b6696edb3d2aff87b585e8/external/build_bazel_rules_nodejs/index.bzl:65:14: node_repository attribute not set and no repository named 'nodejs_toolchains' exists; installing default node
ERROR: error loading package 'bazel-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: 9 packages loaded
    currently loading: bazel-workspace/external/build_bazel_rules_nodejs/third_party/npm/node_modules/named-amd ... (3 packages)
Loading: 9 packages loaded
    currently loading: bazel-workspace/external/build_bazel_rules_nodejs/third_party/npm/node_modules/named-amd ... (3 packages)

Two observations:

  • Running bazel clean temporarily fixes it until I rerun a command outside of the plugin.
  • Enabling setting Bazel: Queries Share Server seems to fix it.

Same issue. Setting Bazel: Queries Share Server fixes the issue.

same here. This happens in a large monorepo code base. Maybe VSCode bazel times out during the "bazel query" stage and then leaves the bazel cache in some bad state which produces that error

Duplicate of #216