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

[Bug]: ERROR: key "windows_amd64" not found in dictionary in aspect_bazel_lib_register_toolchains #690

Open
sloretz opened this issue Dec 12, 2023 · 1 comment
Labels
bug Something isn't working untriaged Requires traige

Comments

@sloretz
Copy link

sloretz commented Dec 12, 2023

What happened?

I ran bazel sync on Linux in a workspace which depends on aspect-build/bazel-lib. It failed with an error about a dictionary not containing a key for a different platform.

Version

Development (host) and target OS/architectures:

Output of bazel --version:

$ bazel --version
bazel 6.2.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

2.0.2

Language(s) and/or frameworks involved:

None

How to reproduce

1. Create a folder called `mre_bazel_sync`
2. Create an empty `BUILD` file
3. Create a `WORKSPACE` file with the following content.


workspace(name = "mre_bazel_sync")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "aspect_bazel_lib",
    sha256 = "4c1de11ebabc23a3c976b73a2b2647596f545beda8a61d2c1c034e07f3f8b976",
    strip_prefix = "bazel-lib-2.0.2",
    url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.0.2/bazel-lib-v2.0.2.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
aspect_bazel_lib_dependencies()
aspect_bazel_lib_register_toolchains()


4. Run `bazel sync`

Any other information?

INFO: Repository bsd_tar_windows_amd64 instantiated at:
  /home/sloretz/projects/sdk/mre-sync-issue/WORKSPACE:14:37: in <toplevel>
  /home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/repositories.bzl:250:28: in aspect_bazel_lib_register_toolchains
  /home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/repositories.bzl:94:27: in register_tar_toolchains
Repository rule bsdtar_binary_repo defined at:
  /home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl:165:37: in <toplevel>
ERROR: An error occurred during the fetch of repository 'bsd_tar_windows_amd64':
   Traceback (most recent call last):
        File "/home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl", line 143, column 30, in _bsdtar_binary_repo
                for lib in LINUX_LIB_DEPS[rctx.attr.platform]:
Error: key "windows_amd64" not found in dictionary
ERROR: /home/sloretz/projects/sdk/mre-sync-issue/WORKSPACE:14:37: fetching bsdtar_binary_repo rule //external:bsd_tar_windows_amd64: Traceback (most recent call last):
        File "/home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl", line 143, column 30, in _bsdtar_binary_repo
                for lib in LINUX_LIB_DEPS[rctx.attr.platform]:
Error: key "windows_amd64" not found in dictionary
INFO: Repository bsd_tar_host instantiated at:
  /home/sloretz/projects/sdk/mre-sync-issue/WORKSPACE:14:37: in <toplevel>
  /home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/repositories.bzl:250:28: in aspect_bazel_lib_register_toolchains
  /home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/repositories.bzl:94:27: in register_tar_toolchains
Repository rule bsdtar_binary_repo defined at:
  /home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl:165:37: in <toplevel>
ERROR: An error occurred during the fetch of repository 'bsd_tar_host':
   Traceback (most recent call last):
        File "/home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl", line 125, column 38, in _bsdtar_binary_repo
                tar = _find_usable_system_tar(rctx, tar_name)
        File "/home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl", line 110, column 9, in _find_usable_system_tar
                fail("tar isn't a BSD tar")
Error in fail: tar isn't a BSD tar
ERROR: /home/sloretz/projects/sdk/mre-sync-issue/WORKSPACE:14:37: fetching bsdtar_binary_repo rule //external:bsd_tar_host: Traceback (most recent call last):
        File "/home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl", line 125, column 38, in _bsdtar_binary_repo
                tar = _find_usable_system_tar(rctx, tar_name)
        File "/home/sloretz/.cache/bazel/_bazel_sloretz/b31e869f84d42f493eab6c61a24d6c3e/external/aspect_bazel_lib/lib/private/tar_toolchain.bzl", line 110, column 9, in _find_usable_system_tar
                fail("tar isn't a BSD tar")
Error in fail: tar isn't a BSD tar
ERROR: key "windows_amd64" not found in dictionary
 checking cached actions
@sloretz sloretz added the bug Something isn't working label Dec 12, 2023
@github-actions github-actions bot added the untriaged Requires traige label Dec 12, 2023
@sloretz
Copy link
Author

sloretz commented Dec 13, 2023

Workaround: Replace aspect_bazel_lib_register_toolchains() call with registering the toolchains manually, and don't register the tar toolchain

register_copy_directory_toolchains()
register_copy_to_directory_toolchains()
register_expand_template_toolchains()
register_coreutils_toolchains()
register_jq_toolchains()
register_yq_toolchains()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
None yet
Development

No branches or pull requests

1 participant