pre-commit: "pre-commit-hooks.yaml does not exist"

Hi guys,

After the last release (0.16.0) we started to facing some issues. The message is:

Updating https://github.com/hootsuite/pre-commit-php.git...[INFO] Initializing environment for https://github.com/hootsuite/pre-commit-php.git. 
[INFO] Initializing environment for https://github.com/hootsuite/pre-commit-php.git. 
An error has occurred: InvalidManifestError: 
=====> /home/rof/.pre-commit/repoB1V3Py/.pre-commit-hooks.yaml does not exist 
Check the log at ~/.pre-commit/pre-commit.log"

After force to back to the last version (0.15.4), no more errors found.

Can you give a look on this error?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

For others getting the same error message, pre-commit autoupdate is the usual blanket fix (assuming the upstream repositories are fixed)

pre-commit autoupdate did not resolved the error. In fact, running pre-commit autoupdate throws the same error.

C02VCA2RHTD6:src henryjiang$ git commit -m 'initial precommit'
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /Users/henryjiang/.cache/pre-commit/patch1551915620.
[INFO] Initializing environment for git@github.com:myorg/myrepor.git.
[INFO] Restored changes from /Users/henryjiang/.cache/pre-commit/patch1551915620.
An error has occurred: InvalidManifestError: 
=====> /Users/henryjiang/.cache/pre-commit/repoOvjp2P/.pre-commit-hooks.yaml does not exist
Check the log at /Users/henryjiang/.cache/pre-commit/pre-commit.log

C02VCA2RHTD6:src henryjiang$ pre-commit clean
Cleaned /Users/henryjiang/.cache/pre-commit.

C02VCA2RHTD6:src henryjiang$ pre-commit autoupdate
Updating git@github.com:myorg/myrepor.git...[INFO] Initializing environment for git@github.com:myorg/myrepor.git.

=====> /Users/henryjiang/.cache/pre-commit/repoBh89dY/.pre-commit-hooks.yaml does not exist

that all looks good, though you generally want to avoid head as a rev

You’ll need to make sure that the remote repository myrepo/myrepo has a .pre-commit-hooks.yaml with the proper metadata in a .pre-commit-hooks.yaml

The subtlety is:

  • consuming repos: .pre-commit-config.yaml
  • producing repos: .pre-commit-hooks.yaml

The pre-commit autoupdate command did not work for me.

However, pre-commit clean command workaround did work.

@amr1ta that’s not a good fix as the actual repository is broken, the actual repository should be fixed instead (often pre-commit autoupdate resolves this)

@sheeeng that would probably imply you’re using an unsupported workflow – generally pre-commit clean should be unnecessary

Checking in .pre-commit-config.yaml is suggested. The “remote” repositories are if you want to share that hook definition with multiple consuming repositories