Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gazelle: ERROR: failed to parse: read |0: file already closedΒ #1315

@siennathesane

Description

@siennathesane

🐞 bug report

Affected Rule

I believe it is this one:

load("@rules_python_gazelle_plugin//:def.bzl", "GAZELLE_PYTHON_RUNTIME_DEPS")
gazelle(
    name = "gazelle",
    data = GAZELLE_PYTHON_RUNTIME_DEPS,
    gazelle = "@rules_python_gazelle_plugin//python:gazelle_binary",
)

Is this a regression?

I don't know, I'm a new user

Description

Gazelle fails to generate build configurations

πŸ”¬ Minimal Reproduction

I don't know how to reproduce this, sorry

πŸ”₯ Exception or Error

$ bazel run //:gazelle                                
INFO: Invocation ID: 2bd54e55-b45f-4f5e-871f-df99e91d5daa
INFO: Analyzed target //:gazelle (37 packages loaded, 713 targets configured).
INFO: Found 1 target...
Target //:gazelle up-to-date:
  bazel-bin/gazelle-runner.bash
  bazel-bin/gazelle
INFO: Elapsed time: 0.364s, Critical Path: 0.03s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/gazelle
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_sienna/16dcdf3abbda1ef8268213b48b0911a1/execroot/veridian/bazel-out/darwin_arm64-fastbuild/bin/gazelle.runfiles/rules_python_gazelle_plugin/python/parse.py", line 106, in <module>
    exit(main(sys.stdin, sys.stdout))
  File "/private/var/tmp/_bazel_sienna/16dcdf3abbda1ef8268213b48b0911a1/execroot/veridian/bazel-out/darwin_arm64-fastbuild/bin/gazelle.runfiles/rules_python_gazelle_plugin/python/parse.py", line 91, in main
    outputs.append(parse(repo_root, rel_package_path, filenames[0]))
  File "/private/var/tmp/_bazel_sienna/16dcdf3abbda1ef8268213b48b0911a1/execroot/veridian/bazel-out/darwin_arm64-fastbuild/bin/gazelle.runfiles/rules_python_gazelle_plugin/python/parse.py", line 66, in parse
    content = file.read()
  File "/private/var/tmp/_bazel_sienna/16dcdf3abbda1ef8268213b48b0911a1/external/python_aarch64-apple-darwin/lib/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa4 in position 64: invalid start byte
gazelle: ERROR: failed to parse: read |0: file already closed

🌍 Your Environment

Operating System:

image

Output of bazel version:

Bazelisk version: development
Build label: 6.2.1
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jun 2 17:00:10 2023 (1685725210)
Build timestamp: 1685725210
Build timestamp as int: 1685725210

Rules_python version:

v0.24.0

Anything else relevant?

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    gazelleGazelle plugin related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions