Skip to content

[BUG]: ArgumentException when deserializing enterprise-owned account (owner.type = "enterprise") #3081

Description

@gdhuper

What happened?

Deserializing any GitHub API response whose account type is "enterprise" throws an ArgumentException. This affects enterprise-owned GitHub Apps, which became generally available on 2025-03-10 and return owner.type = "enterprise" from endpoints such as GET /app.

The AccountType enum (Octokit/Models/Response/AccountType.cs) only defines User, Organization, Bot, and Mannequin. Account.Type is a raw AccountType? rather than a StringEnum<AccountType>, so SimpleJsonSerializer calls Enum.Parse(..., "enterprise", ...) and throws for the unknown value.

  var serializer = new SimpleJsonSerializer();
  var app = serializer.Deserialize<GitHubApp>(json); // json has owner.type = "enterprise"

Versions

Octokit.NET 14.0.0

Relevant log output

System.ArgumentException: Requested value 'enterprise' was not found.
     at System.Enum.TryParseByName(...)
     at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
     at
Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeEnumHelper(String
  value, Type type)
     at Octokit.Internal.SimpleJsonSerializer.Deserialize[T](String json)

Notes
Same root cause as #2998 (reported for CheckRunEventPayload); PR #2999 proposed adding the enum member but was auto-closed by the stale bot without merging. This issue tracks the same missing Enterprise account type.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status
    🆕 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions