Skip to content

[BUG]: InvalidConfigError in .pre-commit-config.yaml – Unsupported stage 'pre-commit' #229

@Tatianah3

Description

@Tatianah3

Severity

Breaking Bug (functionality doesn't work at all)

Priority

High (significantly impacts usability)

Steps to Reproduce

  1. Clone the repository and checkout the fix/update-contributors-push branch.
  2. Ensure pre-commit is installed.
  3. Run git commit -m "Updating comments".
  4. Observe the error from pre-commit.

Expected Behavior

The pre-commit hooks should execute successfully during the commit, without any configuration error.

Actual Behavior

An error is thrown:

InvalidConfigError:
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='local')
==> At key: hooks
==> At Hook(id='pytest')
==> At key: stages
==> At index 0
=====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit'

System Information

Debug Information

System Information

  • Date: Wed May 8 2025
  • OS: Windows (MINGW64 on Git Bash)
  • Architecture: x86_64

Development Tools

  • Python: Python 3.11.7
  • uv: uv 0.1.24
  • ruff: ruff 0.1.9
  • git: git version 2.43.0.windows.1
  • just: just 1.21.0

Screenshots

N/A

Logs

InvalidConfigError:
==> File .pre-commit-config.yaml        
==> At Config()
==> At key: repos
==> At Repository(repo='local')
==> At key: hooks
==> At Hook(id='pytest')
==> At key: stages
==> At index 0
=====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit'

Possible Solution

In .pre-commit-config.yaml, replace:

```yaml
stages: [pre-commit]

with:


yaml
stages: [commit]

This change aligns with the supported values listed in the pre-commit documentation.

Contribution

Yes, I'd be willing to work on a fix

Pre-submission Confirmation

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions