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

InvalidConfigError: .pre-commit-config.yaml does not exist #457

Closed
livc opened this issue Dec 31, 2016 · 6 comments
Closed

InvalidConfigError: .pre-commit-config.yaml does not exist #457

livc opened this issue Dec 31, 2016 · 6 comments
Labels

Comments

@livc
Copy link

livc commented Dec 31, 2016

Afer pre-commit install in my repo, I commit it and get:

➜  recommender_system git:(recommender_sys) ✗ git commit -m "test pre-commit"
An error has occurred: InvalidConfigError: File /Users/zhao/repo/book/.pre-commit-config.yaml does not exist
Check the log at ~/.pre-commit/pre-commit.log

pre-commit.log

An error has occurred: InvalidConfigError: File /Users/zhao/repo/book/.pre-commit-config.yaml does not exist
Traceback (most recent call last):
  File "/usr/local/Cellar/pre-commit/0.9.4/libexec/lib/python2.7/site-packages/pre_commit/error_handler.py", line 47, in error_handler
    yield
  File "/usr/local/Cellar/pre-commit/0.9.4/libexec/lib/python2.7/site-packages/pre_commit/main.py", line 181, in main
    return run(runner, args)
  File "/usr/local/Cellar/pre-commit/0.9.4/libexec/lib/python2.7/site-packages/pre_commit/commands/run.py", line 210, in run
    repo_hooks = list(get_repo_hooks(runner))
  File "/usr/local/Cellar/pre-commit/0.9.4/libexec/lib/python2.7/site-packages/pre_commit/commands/run.py", line 159, in get_repo_hooks
    for repo in runner.repositories:
  File "/usr/local/Cellar/pre-commit/0.9.4/libexec/lib/python2.7/site-packages/cached_property.py", line 26, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/Cellar/pre-commit/0.9.4/libexec/lib/python2.7/site-packages/pre_commit/runner.py", line 43, in repositories
    config = load_config(self.config_file_path)
  File "/usr/local/Cellar/pre-commit/0.9.4/libexec/lib/python2.7/site-packages/pre_commit/clientlib/validate_base.py", line 41, in validate
    raise exception_type('File {} does not exist'.format(filename))
InvalidConfigError: File /Users/zhao/repo/book/.pre-commit-config.yaml does not exist


@asottile
Copy link
Member

Do you have a .pre-commit-config.yaml? You need one of those to tell pre-commit what hooks you want to run. To see how to configure one, see http://pre-commit.com

@livc
Copy link
Author

livc commented Jan 1, 2017

@asottile Sorry, I forgot to merge latest from source repo. So there is no .pre-commit-config.yaml.

Thanks for your help!

@livc livc closed this as completed Jan 1, 2017
@asottile
Copy link
Member

asottile commented Jan 2, 2017

No problem! Good to hear you figured it out. Do you have any suggestions to improve the messaging?

@khairnarTK
Copy link

khairnarTK commented Jul 4, 2019

An error has occurred: InvalidManifestError: 
=====> /Users/tushar/.cache/pre-commit/repogi2yhmej/.pre-commit-hooks.yaml does not exist
Check the log at /Users/tushar/.cache/pre-commit/pre-commit.log

& pre-commit.log -> detail's

An error has occurred: InvalidManifestError: 
=====> /Users/tushar/.cache/pre-commit/repogi2yhmej/.pre-commit-hooks.yaml does not exist
Traceback (most recent call last):
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/cfgv.py", line 46, in reraise_as
    yield
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/cfgv.py", line 412, in load_from_filename
    raise ValidationError('{} does not exist'.format(filename))
cfgv.ValidationError: 
=====> /Users/tushar/.cache/pre-commit/repogi2yhmej/.pre-commit-hooks.yaml does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/pre_commit/error_handler.py", line 46, in error_handler
    yield
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/pre_commit/main.py", line 294, in main
    return run(args.config, store, args)
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/pre_commit/commands/run.py", line 282, in run
    for hook in all_hooks(config, store)
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/pre_commit/repository.py", line 221, in all_hooks
    for repo in root_config['repos']
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/pre_commit/repository.py", line 222, in <genexpr>
    for hook in _repository_hooks(repo, store, root_config)
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/pre_commit/repository.py", line 197, in _repository_hooks
    return _cloned_repository_hooks(repo_config, store, root_config)
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/pre_commit/repository.py", line 167, in _cloned_repository_hooks
    by_id = {hook['id']: hook for hook in load_manifest(manifest_path)}
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/cfgv.py", line 424, in load_from_filename
    return apply_defaults(data, schema)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/cfgv.py", line 49, in reraise_as
    six.reraise(tp, tp(e), tb)
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/cfgv.py", line 46, in reraise_as
    yield
  File "/usr/local/Cellar/pre-commit/1.17.0/libexec/lib/python3.7/site-packages/cfgv.py", line 412, in load_from_filename
    raise ValidationError('{} does not exist'.format(filename))
pre_commit.clientlib.InvalidManifestError: 
=====> /Users/tushar/.cache/pre-commit/repogi2yhmej/.pre-commit-hooks.yaml does not exist

@asottile
Copy link
Member

asottile commented Jul 4, 2019

@khairnarTK whatever repository you tried to hook up does not have a .pre-commit-hooks.yaml

the error alone is not useful, you need to show your configuration

@asottile
Copy link
Member

asottile commented Jul 4, 2019

your error is also different, OP's issue is about .pre-commit-*config*.yaml yours is .pre-commit-*hooks*.yaml

droctothorpe pushed a commit to droctothorpe/pre-commit that referenced this issue Mar 23, 2022
Fix docs for pretty-format-json: default indent is **2** spaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants