GitHub App: teams.addOrUpdateRepo

I’m using the below code to add a Team to one of my Orginization’s repository:

try {
      const addTeam = await context.github.teams.addOrUpdateRepo({ owner: 'weirgroup', permission: "pull", repo: 'devops-docs', team_id: weirDevTeamId });
      if (addTeam.status === 204) {`Successfully added Weir Developers to ${}`);
      } else {
        context.log.warn(`We experienced an issue adding Weir Developers to ${}.\n\n${addTeam.headers}`);
    } catch (error) {
      context.log.fatal(`Error ${error}`);

I’m getting the following response:

23:49:46.063Z DEBUG github: GitHub request: PUT /teams/:team_id/repos/:owner/:repo - 422 undefined (installation=47431x)
  params: {
    "owner": "weirgroup",
    "permission": "pull",
    "repo": "devops-docs",
    "team_id": 2978570,
    "baseUrl": "",
    "request": {
      "timeout": 0
23:49:46.063Z FATAL event: Error {"message":"Validation Failed","errors":[{"resource":"TeamRepository","code":"unprocessable","field":"data","message":"You must have administrative rights on this repository."}],"documentation_url":""}

Other calls are successful within my Orginization – My GitHub App has literally every permission set to Write or Admin. Can someone help point me in the right direction please?

Hi @intolerance,

Thanks for being here! If you haven’t already, please contact us at with the info so we can look into that further.