Skip to content

[BUG]: RepositoryVariablesClient.Create() throws NotFoundException #3032

@akordowski

Description

@akordowski

What happened?

While creating repository variables in a loop I get for some variables a NotFoundException.
I could narrow it down to the function RepositoryVariablesClient.Create()

https://github.com/octokit/octokit.net/blob/7fa5b0fe4a18c9b981b21290c3ca9320b2d6415b/Octokit/Clients/RepositoryVariablesClient.cs#L95C1-L108C10

As you can see it creates the variable first and then tries to load it, where the error occurs. I checked the repository settings and the variable was indeed successfully created. So it seams that there is a small time frame where the variable can not be found after the creation.

Maybe it would make sense to implement a delay or a retry as a fallback. What do you think?

Versions

Octokit.NET 14.0.0

Relevant log output

Octokit.NotFoundException: Not Found
   at Octokit.Connection.HandleErrors(IResponse response) in /_/Octokit/Http/Connection.cs:line 817
   at Octokit.Connection.RunRequest(IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 798
   at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 783
   at Octokit.ApiConnection.Get[T](Uri uri, IDictionary`2 parameters)
   at Octokit.RepositoryVariablesClient.Create(String owner, String repoName, Variable newVariable) in /_/Octokit/Clients/RepositoryVariablesClient.cs:line 107

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