pre-commit: An error has occurred: InvalidManifestError

when i use pre-commit run --all-files i got this error

[INFO] Initializing environment for git@github.com:kobeTianSilk/py3-bundleb2b.git.
An error has occurred: InvalidManifestError: 
=====> /Users/kobetian/.cache/pre-commit/repogfm2l6s7/.pre-commit-hooks.yaml does not exist
Check the log at /Users/kobetian/.cache/pre-commit/pre-commit.log

here is my code

default_language_version:
    python: python3.7
default_stages: [commit, push]
repos:
-   repo: git@github.com:kobeTianSilk/py3-bundleb2b.git
    rev: 896b92dcdbf567c5c0197fc6575e0c8bf6d2b5b3
    hooks:
    -   id: python-pylint
    -   id: python-isort
    -   id: autopep8
    -   id: black
        language_version: python3.7

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (14 by maintainers)

Most upvoted comments

I was running into this issue, and rm -rf ~/.cache/pre-commit followed by a pre-commit install fixed it

I was running into this issue, and rm -rf ~/.cache/pre-commit followed by a pre-commit install fixed it

I had the same issue and could resolve it in the same way. I think it was caused because the path to my home directory changed and pre-commit was still referring to the old path for some reason:

An error has occurred: InvalidManifestError:
=====> /Volumes/Home/blubb/.cache/pre-commit/reportiehxn8/.pre-commit-hooks.yaml does not exist
Check the log at /Users/jgosmann/.cache/pre-commit/pre-commit.log

/Volumes/Home/blubb is the old path, /Users/jgosmann the new one.

Thanks @bagerard .

In the end I defaulted to using the docker image for the pre-commit cache — not ideal for image sizes, but saves enough time to make it worthwhile, and we can rely on a single approach for caching.

feel free to send a PR to the docs if they should be improved

On Thu, Dec 2, 2021, 5:03 PM Bastien Gérard @.***> wrote:

@asottile https://github.com/asottile What do you think of documenting this in the doc section of pre-commit that describes how to set up gitlab’s cache (https://pre-commit.com/#gitlab-ci-example). It could be as simple as “Be aware of this [#issue] related with non-constant build location in the runners” linking that with a new Issue that we would create in this repo. Happy to help if you think that is a good idea.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pre-commit/pre-commit/issues/1133#issuecomment-985037840, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN2BH6TWBPAAKFLPWU5CG3UO7UMNANCNFSM4IU5XOPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

as the error says, you’re missing a .pre-commit-hooks.yaml in your repo