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

pre-push hook failed with "ValueError: too many values to unpack (expected 4)" #2344

Closed
wwade opened this issue Apr 14, 2022 · 1 comment · Fixed by #2345
Closed

pre-push hook failed with "ValueError: too many values to unpack (expected 4)" #2344

wwade opened this issue Apr 14, 2022 · 1 comment · Fixed by #2345

Comments

@wwade
Copy link
Contributor

wwade commented Apr 14, 2022

describe your issue

I ran

git push --dry-run origin HEAD^"{/^[a-zA-Z]+: }":refs/for/main%wip

and expected the hook to run properly, but it failed with a somewhat subtle error:

An unexpected error has occurred: ValueError: too many values to unpack (expected 4)
Check the log at $HOME/.cache/pre-commit/pre-commit.log

It was more clear from the pre-commit.log file, though (see below). I reproduced the issue using HEAD (f9473e7) as well.

pre-commit --version

2.12.1

.pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
      - id: check-added-large-files
      - id: check-json
      - id: check-yaml
      - id: end-of-file-fixer
      - id: trailing-whitespace

  - repo: https://github.com/wwade/pre-commit-golang
    rev: 503834f5c0933fbdf9a55e92329c1957e48f6d0a
    hooks:
      - id: go-fmt
      - id: go-imports
      - id: go-cyclo
        args: [-over=15]
      - id: validate-toml
      - id: golangci-lint
      - id: go-unit-tests
      - id: go-mod-tidy

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 2.12.1
sys.version:
    3.8.10 (default, Mar 15 2022, 12:22:08) 
    [GCC 9.4.0]
sys.executable: /usr/bin/python3
os.name: posix
sys.platform: linux

error information

An unexpected error has occurred: ValueError: too many values to unpack (expected 4)
Traceback (most recent call last):
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/error_handler.py", line 65, in error_handler
    yield
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/main.py", line 357, in main
    return hook_impl(
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/commands/hook_impl.py", line 223, in hook_impl
    ns = _run_ns(hook_type, color, args, stdin)
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/commands/hook_impl.py", line 195, in _run_ns
    return _pre_push_ns(color, args, stdin)
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/commands/hook_impl.py", line 113, in _pre_push_ns
    _, local_sha, remote_branch, remote_sha = line.split()
ValueError: too many values to unpack (expected 4)
@wwade
Copy link
Contributor Author

wwade commented Apr 14, 2022

I have a fix coming 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant