Skip to content

Crash on invalid configuration: not existing parent #137

@rhorenov

Description

@rhorenov

Crash on invalid configuration: not existing parent

Description

gh-org-mgr sync crashes with UnknownObjectException: 404 when a team configuration references a non-existing parent team.

Tested version: github-org-manager==0.7.4, installed using uv tools from PyPI index.

This is similar to the fixed and closed issue #123, possible regression?

Steps to Reproduce

  1. Set parent: to a non-existing team name in a team YAML file
  2. Run gh-org-mgr sync -c . --dry
  3. Tool crashes during team settings configuration

Expected Behavior

Should handle non-existing parent teams gracefully or show a clear error message.

Actual Behavior

Crashes with UnknownObjectException when trying to look up the parent team.

Sample Configuration

File: teams/admin-team.yaml

Admin Team:
  description: "Organization administrators"
  privacy: "closed"
  maintainer:
    - some_user
  repos:
    cool-project: maintain

Development Team:
  description: "Core development team for application development"
  privacy: "closed"
  notification_setting: "notifications_enabled"
  maintainer:
    - some_user
  parent: Missing Team # Problem - crash when the team does not exist
  member:
    - developer-1
  repos:
    cool-project: maintain

Stack Trace

⏳ Configuring team settings...Traceback (most recent call last):
  File "C:\Users\rhorenov\AppData\Roaming\uv\tools\github-org-manager\Lib\site-packages\gh_org_mgr\_gh_org.py", line 358, in _prepare_team_config_for_sync
    team_config["parent_team_id"] = self.org.get_team_by_slug(
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rhorenov\AppData\Roaming\uv\tools\github-org-manager\Lib\site-packages\github\Organization.py", line 1394, in get_team_by_slug
    headers, data = self._requester.requestJsonAndCheck("GET", f"{self.url}/teams/{slug}")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/teams/teams#get-a-team-by-name", "status": "404"}

Metadata

Metadata

Assignees

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