diff --git a/libs/community/langchain_community/utilities/github.py b/libs/community/langchain_community/utilities/github.py index d6e1a0833e..e9929e451f 100644 --- a/libs/community/langchain_community/utilities/github.py +++ b/libs/community/langchain_community/utilities/github.py @@ -76,8 +76,16 @@ class GitHubAPIWrapper(BaseModel): private_key, ) gi = GithubIntegration(auth=auth) - installation = gi.get_installations()[0] - + installation = gi.get_installations() + if not installation: + raise ValueError( + f"Please make sure to install the created github app with id " + f"{github_app_id} on the repo: {github_repository}" + "More instructions can be found at " + "https://docs.github.com/en/apps/using-" + "github-apps/installing-your-own-github-app" + ) + installation = installation[0] # create a GitHub instance: g = installation.get_github_for_installation() repo = g.get_repo(github_repository)