{"record":{"id":"b01ab823222cb5c8","repo":"microsoft/autogen","slug":"repository-name-is-null","errorCode":null,"errorMessage":"Repository name is null","messagePattern":"Repository name is null","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/samples/dev-team/DevTeam.Backend/Services/GithubWebHookProcessor.cs","lineNumber":31,"sourceCode":"\nnamespace DevTeam.Backend.Services;\n\npublic sealed class GithubWebHookProcessor(ILogger<GithubWebHookProcessor> logger, Client client) : WebhookEventProcessor\n{\n    private readonly ILogger<GithubWebHookProcessor> _logger = logger;\n    private readonly Client _client = client;\n\n    protected override async Task ProcessIssuesWebhookAsync(WebhookHeaders headers, IssuesEvent issuesEvent, IssuesAction action)\n    {\n        try\n        {\n            ArgumentNullException.ThrowIfNull(headers, nameof(headers));\n            ArgumentNullException.ThrowIfNull(issuesEvent, nameof(issuesEvent));\n            ArgumentNullException.ThrowIfNull(action, nameof(action));\n\n            _logger.LogInformation(\"Processing issue event\");\n            var org = issuesEvent.Repository?.Owner.Login ?? throw new InvalidOperationException(\"Repository owner login is null\");\n            var repo = issuesEvent.Repository?.Name ?? throw new InvalidOperationException(\"Repository name is null\");\n            var issueNumber = issuesEvent.Issue?.Number ?? throw new InvalidOperationException(\"Issue number is null\");\n            var input = issuesEvent.Issue?.Body ?? string.Empty;\n            // Assumes the label follows the following convention: Skill.Function example: PM.Readme\n            // Also, we've introduced the Parent label, that ties the sub-issue with the parent issue\n            var labels = issuesEvent.Issue?.Labels\n                                    .Select(l => l.Name.Split('.'))\n                                    .Where(parts => parts.Length == 2)\n                                    .ToDictionary(parts => parts[0], parts => parts[1]);\n            if (labels == null || labels.Count == 0)\n            {\n                _logger.LogWarning(\"No labels found in issue. Skipping processing.\");\n                return;\n            }\n\n            long? parentNumber = labels.TryGetValue(\"Parent\", out var value) ? long.Parse(value) : null;\n            var skillName = labels.Keys.Where(k => k != \"Parent\").FirstOrDefault();\n\n            if (skillName == null)","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/samples/dev-team/DevTeam.Backend/Services/GithubWebHookProcessor.cs#L13-L49","documentation":"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.","triggerScenarios":"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.","commonSituations":"Local webhook testing with partial payloads; GitHub Events API shape changes; custom middleware that re-serializes payloads and drops fields.","solutions":["Use a genuine GitHub delivery payload (redeliver from the repo's webhook settings page) rather than a hand-built one.","When crafting test fixtures, include the full repository object: name, owner.login, owner.name.","Verify the Octokit webhook package version matches the GitHub event schema you receive.","Pair with error 87's fix: validate Repository?.FullName once and throw a single descriptive error covering both fields."],"exampleFix":"// before\nvar repo = issuesEvent.Repository?.Name ?? throw new InvalidOperationException(\"Repository name is null\");\n\n// after\nvar repo = issuesEvent.Repository?.Name\n    ?? throw new InvalidOperationException($\"Repository name is null for org '{org}'; webhook payload is incomplete.\");","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(issuesEvent.Repository?.Name))\n{\n    _logger.LogWarning(\"Webhook payload missing repository.name; skipping.\");\n    return;\n}","typeGuard":"static bool HasRepoContext(IssuesEvent e) => !string.IsNullOrWhiteSpace(e?.Repository?.Owner?.Login) && !string.IsNullOrWhiteSpace(e?.Repository?.Name) && e?.Issue?.Number is not null;","tryCatchPattern":"catch (InvalidOperationException) when (issuesEvent?.Repository?.Name is null) { _logger.LogWarning(\"Incomplete repository payload; skipping event.\"); return; }","preventionTips":["Combine org/repo/issue guards into one HasRepoContext check and skip-with-200 on failure so GitHub does not redeliver unprocessable events.","Keep webhook test fixtures in the repo (full payload JSON) so local tests exercise the real shape."],"tags":["github","webhook","octokit","dev-team-sample","payload-validation","csharp"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}