microsoft/autogen · error · InvalidOperationException

Repository name is null

Error message

Repository name is null

What it means

Same guard block as error 87: the dev-team webhook processor throws when an IssuesEvent carries no Repository.Name. It is checked immediately after the owner-login guard, so any payload reaching this line already passed the owner check; a null repo name means the repository object exists but its name field is missing/empty in the deserialized payload.

Source

Thrown at dotnet/samples/dev-team/DevTeam.Backend/Services/GithubWebHookProcessor.cs:31

namespace DevTeam.Backend.Services;

public sealed class GithubWebHookProcessor(ILogger<GithubWebHookProcessor> logger, Client client) : WebhookEventProcessor
{
    private readonly ILogger<GithubWebHookProcessor> _logger = logger;
    private readonly Client _client = client;

    protected override async Task ProcessIssuesWebhookAsync(WebhookHeaders headers, IssuesEvent issuesEvent, IssuesAction action)
    {
        try
        {
            ArgumentNullException.ThrowIfNull(headers, nameof(headers));
            ArgumentNullException.ThrowIfNull(issuesEvent, nameof(issuesEvent));
            ArgumentNullException.ThrowIfNull(action, nameof(action));

            _logger.LogInformation("Processing issue event");
            var org = issuesEvent.Repository?.Owner.Login ?? throw new InvalidOperationException("Repository owner login is null");
            var repo = issuesEvent.Repository?.Name ?? throw new InvalidOperationException("Repository name is null");
            var issueNumber = issuesEvent.Issue?.Number ?? throw new InvalidOperationException("Issue number is null");
            var input = issuesEvent.Issue?.Body ?? string.Empty;
            // Assumes the label follows the following convention: Skill.Function example: PM.Readme
            // Also, we've introduced the Parent label, that ties the sub-issue with the parent issue
            var labels = issuesEvent.Issue?.Labels
                                    .Select(l => l.Name.Split('.'))
                                    .Where(parts => parts.Length == 2)
                                    .ToDictionary(parts => parts[0], parts => parts[1]);
            if (labels == null || labels.Count == 0)
            {
                _logger.LogWarning("No labels found in issue. Skipping processing.");
                return;
            }

            long? parentNumber = labels.TryGetValue("Parent", out var value) ? long.Parse(value) : null;
            var skillName = labels.Keys.Where(k => k != "Parent").FirstOrDefault();

            if (skillName == null)

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Use a genuine GitHub delivery payload (redeliver from the repo's webhook settings page) rather than a hand-built one.
  2. When crafting test fixtures, include the full repository object: name, owner.login, owner.name.
  3. Verify the Octokit webhook package version matches the GitHub event schema you receive.
  4. Pair with error 87's fix: validate Repository?.FullName once and throw a single descriptive error covering both fields.

Example fix

// before
var repo = issuesEvent.Repository?.Name ?? throw new InvalidOperationException("Repository name is null");

// after
var repo = issuesEvent.Repository?.Name
    ?? throw new InvalidOperationException($"Repository name is null for org '{org}'; webhook payload is incomplete.");
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrWhiteSpace(issuesEvent.Repository?.Name))
{
    _logger.LogWarning("Webhook payload missing repository.name; skipping.");
    return;
}

Type guard

static bool HasRepoContext(IssuesEvent e) => !string.IsNullOrWhiteSpace(e?.Repository?.Owner?.Login) && !string.IsNullOrWhiteSpace(e?.Repository?.Name) && e?.Issue?.Number is not null;

Try / catch

catch (InvalidOperationException) when (issuesEvent?.Repository?.Name is null) { _logger.LogWarning("Incomplete repository payload; skipping event."); return; }

Prevention

When it happens

Trigger: A webhook payload where repository.owner.login deserializes but repository.name is absent; hand-crafted test JSON that includes owner but not name; serialization casing mismatch (Name vs name) after an Octokit/webhook package upgrade.

Common situations: Local webhook testing with partial payloads; GitHub Events API shape changes; custom middleware that re-serializes payloads and drops fields.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/b01ab823222cb5c8. Report an issue: GitHub.