"Validation failed" error on searching in private repository with installation of GitHub App

I’ve created a GitHub app and installed it in my account, giving it access to a private repository in my account. The GitHub app has read permission to metadata.
I then generated a JWT and used it to create an installation access token, following the steps here.
I tried using this token to search for keywords in the above private repository using the GitHub search API as follows:


However, this returns the following response.

    "message": "Validation Failed",
    "errors": [
            "message": "The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.",
            "resource": "Search",
            "field": "q",
            "code": "invalid"
    "documentation_url": "https://docs.github.com/v3/search/"

I tried using this access token to fetch the repositories for this GitHub app installation and that returned the private repo successfully in the response.

API used: https://api.github.com/installation/repositories. I assume this means that the installation has access to the private repo and the token works as expected.

Why does the search fail then?