Skip to content

settings.yml triggers unwanted rename via PATCH – "name already exists on this account" error #851

@poongothai

Description

@poongothai

Problem Description

We are using the github/safe-settings app to manage organization-level repo configurations via settings.yml. However, it unexpectedly attempts to rename a repository during a PATCH request—even though we do not specify a name field in our config.

What is actually happening

The app issues a PATCH request to update a repository and includes the "name" field in the request body:

"name": "RepoX"

This results in a 422 Validation Failed error:
"errors":[
  {
    "resource":"Repository",
    "code":"custom",
    "field":"name",
    "message":"name already exists on this account"
  }
]

This happens even though name: is not configured in our settings.yml.

### What is the expected behavior
The app should not include the name field in the PATCH payload unless it is explicitly defined in the settings.yml. No rename attempts should happen unless intentional.

### Error output, if available
DEBUG (RepoX): GitHub request: PATCH https://api.github.com/repos/org-name/repo-name - 422
  private: true
  visibility: "private"
  has_issues: true
  has_wiki: true
  default_branch: "trunk"
  allow_squash_merge: true
  allow_merge_commit: false
  allow_rebase_merge: false
  delete_branch_on_merge: true
  security_and_analysis: {
    "advanced_security": {
      "status": "enabled"
    },
    "secret_scanning": {
      "status": "enabled"
    },
    "secret_scanning_push_protection": {
      "status": "enabled"
    }
  }
  security: {
    "enableVulnerabilityAlerts": true
  }
  org: "org-name"

ERROR (probot): Error {"name":"HttpError","status":422,"response":{"url":"https://api.github.com/repos/org-name/repo-name","status":422,"data":{"message":"Validation Failed","errors":[{"resource":"Repository","code":"custom","field":"name","message":"name already exists on this account"}]}},"request":{"method":"PATCH","url":"https://api.github.com/repos/org-name/repo-name","headers":{"authorization":"token [REDACTED]"},"body":"{\"private\":true, ... ,\"name\":\"RepoX\",\"org\":\"org-name\"}"}}


## Context

### Are you using the hosted instance of probot/settings or running your own?
Running via GitHub Actions using the github/safe-settings repo.

### If running your own instance, are you using it with github.com or GitHub Enterprise?
Using with github Enterprise

#### Version of probot/settings
2.1.16 (referenced in GitHub Actions workflow)

#### Version of GitHub Enterprise

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions