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

hermes init fails with cryptic error message in non-git directory #308

Open
zyzzyxdonta opened this issue Feb 3, 2025 · 4 comments
Open
Assignees
Labels
0️⃣init The initial configuration of the workflow bug Something isn't working

Comments

@zyzzyxdonta
Copy link
Contributor

zyzzyxdonta commented Feb 3, 2025

When running hermes init in a non-git directory, it fails with:

No connection adapters were found for ':///api/v4/version'

This is due to urlparse() not "failing" but rather returning empty strings, here:

parsed_url = urlparse(info.git_remote_url)

It might make sense to wrap urlparse() and raise an exception if either of scheme or netloc is not existent. (Or abort searching for git stuff way earlier.)

@zyzzyxdonta zyzzyxdonta added the bug Something isn't working label Feb 3, 2025
@nheeb nheeb self-assigned this Feb 11, 2025
@poikilotherm poikilotherm added the 0️⃣init The initial configuration of the workflow label Feb 11, 2025
nheeb added a commit that referenced this issue Feb 18, 2025
@poikilotherm
Copy link
Member

Closes by now merged #309

@dnlbauer
Copy link

dnlbauer commented Feb 26, 2025

@poikilotherm I still see this cryptic message when using hermes init on an empty repository when it does not have an upstream repository set. it would be nice to have a better error message in this case.

Steps to reproduce:

install latest hermes from git

> pipx install git+https://github.com/hermes-hmc/hermes.git

  installed package hermes 0.9.0, installed using Python 3.12.3
  These apps are now globally available
    - hermes
    - hermes-marketplace
done!

create a new git repo and init it with a file

>mkdir -p /tmp/test && cd /tmp/test
>git init
>echo "test" >> testfile.txt
>git add testfile.txt
>git commit -m "add test file"

run hermes init

>hermes init
Run subcommand init

hermes.log file:

1740587078.834470:          hermes.cli:     DEBUG | Running hermes with the following command line arguments: Namespace(subcommand='init', path=PosixPath('.'), config=PosixPath('hermes.toml'), options=[], template_branch='', command=<hermes.commands.init.base.HermesInitCommand object at 0x749c550ae930>)
1740587078.834665:          hermes.cli:     DEBUG | Loading settings...
1740587078.834707:          hermes.cli:     DEBUG | Update settings from command line...
1740587078.834739:          hermes.cli:      INFO | Run subcommand init
1740587078.843297:          hermes.cli:     ERROR | An error occurred during execution of init (Find details in './hermes.log')
1740587078.843416:          hermes.cli:     DEBUG | Original exception was: No connection adapters were found for ':///api/v4/version'

@dnlbauer
Copy link

dnlbauer commented Feb 26, 2025

It also happens on an existing project from me that has multiple remotes configured in the git config (i.e. we have projects on our local git as well as github):

steps to reproduce:

git clone https://github.com/dnlbauer/django-signposting
cd django-signplosting
hermes init # this works!

# add second remote
git remote add secondary http://example.com/django-signposting
hermes init # fails

@poikilotherm poikilotherm reopened this Feb 26, 2025
@poikilotherm
Copy link
Member

Thanks for reporting back! I'm assigning @nheeb to look into this 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0️⃣init The initial configuration of the workflow bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants