Skip to content

bazel mod tidy fails with could not apply patch #122

@ash2k

Description

@ash2k

Trying to upgrade from 0.4.0 to 0.5.0 and getting this error:

$ bazel mod tidy                                                                                                          
INFO: Repository rules_buf+ instantiated at:
  <builtin>: in <toplevel>
Repository rule http_archive defined at:
  /external/bazel_tools/tools/build_defs/repo/http.bzl:394:31: in <toplevel>
INFO: repository @@rules_buf+' used the following cache hits instead of downloading the corresponding file.
 * Hash '24dfb616f3bc069e484da76134ef018ec5daf4891d4b6f7e848570fc7428d678' for https://bcr.bazel.build/modules/rules_buf/0.5.0/patches/module_dot_bazel_version.patch
 * Hash '92d2fbe24e00929a9965a7ab7d9b531d626cd3b4afcafcd6eac17db50f7ecd4b' for https://bcr.bazel.build/modules/rules_buf/0.5.0/patches/fix_bazel_presubmit.patch
 * Hash '19ca4b0359f03c41563054d54812602fcf925e86d62832581cba8c524ee419b1' for https://github.com/bufbuild/rules_buf/archive/refs/tags/v0.5.0.tar.gz
If the definition of 'repository @@rules_buf+' was updated, verify that the hashes were also updated.
ERROR: /external/bazel_tools/tools/build_defs/repo/utils.bzl:196:18: An error occurred during the fetch of repository 'rules_buf+':
   Traceback (most recent call last):
        File "/external/bazel_tools/tools/build_defs/repo/http.bzl", line 152, column 10, in _http_archive_impl
                patch(ctx)
        File "/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 196, column 18, in patch
                ctx.patch(patchfile, remote_patch_strip)
Error in patch: Error applying patch /external/rules_buf+/.tmp_remote_patches/fix_bazel_presubmit.patch: in patch applied to /external/rules_buf+/MODULE.bazel.lock: could not apply patch due to CONTENT_DOES_NOT_MATCH_TARGET, error applying change near line 199
ERROR: no such package '@@rules_buf+//': Error applying patch /external/rules_buf+/.tmp_remote_patches/fix_bazel_presubmit.patch: in patch applied to /external/rules_buf+/MODULE.bazel.lock: could not apply patch due to CONTENT_DOES_NOT_MATCH_TARGET, error applying change near line 199
    Fetching module extension @@gazelle+//:extensions.bzl%go_deps; starting

I'm on macOS, arm64. Same on Linux CI: https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/merge_requests/2774.

Bazel 8.3.1.

I'm not sure how to get that file to have a look at it. --sandbox_debug doesn't seem to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions