title: “Validation failed” error on searching in private repository with installation of GitHub App
body: <p>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:</p>
  <pre><code>https://api.github.com/search/code?q=abc+in:file+repo:username/private-repo
  </code></pre>
  <p>However, this returns the following response.</p>
  <pre><code>{
      &quot;message&quot;: &quot;Validation Failed&quot;,
      &quot;errors&quot;: [
          {
              &quot;message&quot;: &quot;The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.&quot;,
              &quot;resource&quot;: &quot;Search&quot;,
              &quot;field&quot;: &quot;q&quot;,
              &quot;code&quot;: &quot;invalid&quot;
          }
      ],
      &quot;documentation_url&quot;: &quot;https://docs.github.com/v3/search/&quot;
  }
  </code></pre>
  <p>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. I assume this means that the installation has access to the private repo and the token works as expected.
  API used: <code>https://api.github.com/installation/repositories</code>.</p>
  <p>Why does the search fail then?</p>