microsoft/aspire · error · ArgumentException

Value ' ' is not a valid GUID.

Error message

Value '{value}' is not a valid GUID.

What it means

CloudProviderValidation.ValidateGuid checks that a cloud provider identifier string is a parseable GUID. Empty/null values are rejected by ThrowIfNullOrEmpty, and non-GUID strings throw ArgumentException("Value '{value}' is not a valid GUID.") with the parameter name. Radius cloud provider registrations require GUID-shaped IDs.

Solutions

  1. Pass a valid GUID string, e.g. 'd5a4f3b2-1c9e-4f8a-9b7d-2e6c8a1f0b3c'.
  2. Verify the source of the value (e.g. Azure portal / CLI output) and copy it exactly.
  3. Trim whitespace/quotes and remove surrounding braces if present (Guid.TryParse accepts braces, but verify your value parses).
  4. Test the value locally with Guid.TryParse before wiring it into configuration.

Example fix

// before
ValidateGuid("my-tenant-id", nameof(tenantId));

// after
ValidateGuid("d5a4f3b2-1c9e-4f8a-9b7d-2e6c8a1f0b3c", nameof(tenantId));
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(value) || !Guid.TryParse(value, out _))
{
    throw new ArgumentException($"Value '{value}' is not a valid GUID.", paramName);
}

Try / catch

try
{
    providerBuilder.WithTenantId(tenantId);
}
catch (ArgumentException ex) when (ex.Message.Contains("not a valid GUID"))
{
    logger.LogError("Tenant ID '{Value}' is not a GUID", tenantId);
    throw;
}

Prevention

When it happens

Trigger: Registering/configuring a Radius cloud provider (e.g. via WithAzureCloudProvider-style APIs) passing a value that is not a valid GUID to a parameter validated by ValidateGuid.

Common situations: Copying an ID with surrounding whitespace or braces that don't parse; passing a subscription or resource name instead of a GUID; truncating or hand-editing an ID; using a placeholder value from documentation.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/4bd4a65d648bbd0d. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Radius/CloudProviders/CloudProviderValidation.cs:21

using System.Text.RegularExpressions;

namespace Aspire.Hosting.Radius.CloudProviders;

/// <summary>
/// Lightweight syntactic validators for cloud-provider configuration inputs.
/// Each helper throws <see cref="ArgumentException"/> with
/// <c>paramName</c> set so callers get the offending parameter in the
/// thrown message without bespoke wrapping at every call site.
/// </summary>
internal static partial class CloudProviderValidation
{
    internal static void ValidateGuid(string value, string paramName)
    {
        ArgumentException.ThrowIfNullOrEmpty(value, paramName);
        if (!Guid.TryParse(value, out _))
        {
            throw new ArgumentException($"Value '{value}' is not a valid GUID.", paramName);
        }
    }

    internal static void ValidateNonEmpty(string value, string paramName)
        => ArgumentException.ThrowIfNullOrEmpty(value, paramName);

    internal static void ValidateAwsAccountId(string value, string paramName)
    {
        ArgumentException.ThrowIfNullOrEmpty(value, paramName);
        if (!AwsAccountIdPattern().IsMatch(value))
        {
            throw new ArgumentException(
                $"AWS account ID '{value}' must be exactly 12 digits.", paramName);
        }
    }

    internal static void ValidateIamRoleArn(string value, string paramName)
    {

View on GitHub (pinned to 25830f84bd)