Devolutions/UniGetUI · error · InvalidOperationException

GitHub sign-in is not configured for this build. UNIGETUI_GI

Error message

GitHub sign-in is not configured for this build. UNIGETUI_GITHUB_CLIENT_ID is missing.

What it means

EnsureGitHubClientConfigured checks HasConfiguredGitHubClient, which reads Secrets.GetGitHubClientId() and returns false if the value is blank or equals the literal placeholder "CLIENT_ID_UNSET". When false, any GitHub sign-in attempt (StartGitHubDeviceFlowAsync, CompleteGitHubDeviceFlowAsync) throws InvalidOperationException before contacting GitHub. This is a build-time configuration gate: the OAuth client ID must be baked in via the secrets generation step.

Source

Thrown at src/UniGetUI.Interface.IpcApi/IpcBackupApi.cs:469

        {
            Logger.Warn(ex);
        }

        return auth;
    }

    private static bool HasConfiguredGitHubClient()
    {
        string clientId = Secrets.GetGitHubClientId();
        return !string.IsNullOrWhiteSpace(clientId)
            && !string.Equals(clientId, MissingClientId, StringComparison.Ordinal);
    }

    private static void EnsureGitHubClientConfigured()
    {
        if (!HasConfiguredGitHubClient())
        {
            throw new InvalidOperationException(
                "GitHub sign-in is not configured for this build. UNIGETUI_GITHUB_CLIENT_ID is missing."
            );
        }
    }

    private static GitHubApiClient CreateAnonymousGitHubClient()
    {
        return new GitHubApiClient();
    }

    private static GitHubApiClient CreateAuthenticatedGitHubClient(string? token = null)
    {
        token ??= SecureGHTokenManager.GetToken();
        if (string.IsNullOrWhiteSpace(token))
        {
            throw new InvalidOperationException("GitHub authentication is required for cloud backups.");
        }

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Run the secrets generation script (src/UniGetUI.Avalonia/Infrastructure/generate-secrets.ps1) with a valid UNIGETUI_GITHUB_CLIENT_ID before building.
  2. Register a GitHub OAuth App and use its client ID as the value.
  3. Verify Secrets.GetGitHubClientId() returns a non-placeholder value after rebuild.
  4. Check HasConfiguredGitHubClient() / IpcGitHubAuthInfo.ClientConfigured at runtime before offering sign-in.
Defensive patterns

Strategy: validation

Validate before calling

var status = await IpcBackupApi.GetStatusAsync();
if (!status.Auth.ClientConfigured)
    throw new InvalidOperationException("Build is missing GitHub client ID; run generate-secrets.ps1");

Type guard

static bool IsGitHubClientConfigured(IpcGitHubAuthInfo auth) => auth.ClientConfigured;

Try / catch

try { await IpcBackupApi.StartGitHubDeviceFlowAsync(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("CLIENT_ID"))
{ /* build was not configured with a GitHub OAuth client ID */ }

Prevention

When it happens

Trigger: A build of UniGetUI was produced without running the secrets-generation script (src/UniGetUI.Avalonia/Infrastructure/generate-secrets.ps1), so UNIGETUI_GITHUB_CLIENT_ID is unset or set to the placeholder. Any call to StartGitHubDeviceFlowAsync or CompleteGitHubDeviceFlowAsync triggers the guard.

Common situations: A developer build without secrets configured. A CI build that skipped the secrets step. A self-compiled build where the user did not provide a GitHub OAuth App client ID. The secrets file was deleted or the embedded resource is missing.

Related errors


AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13). Data as JSON: /api/errors/4accfb152e8dcb94. Report an issue: GitHub.