microsoft/aspire · error · InvalidOperationException
Foundry project ' ' did not resolve to an absolute HTTPS…
Error message
Foundry project '{Parent.Name}' did not resolve to an absolute HTTPS endpoint. What it means
When building the toolbox administration client, the resource resolves its parent Foundry project's Endpoint reference and requires an absolute HTTPS URI (the Foundry API is HTTPS-only). If the endpoint reference has not resolved, is relative, or is not https, administration cannot be constructed and it throws.
Solutions
- Ensure the Foundry project resource exposes an absolute HTTPS endpoint (check its endpoint/connection configuration).
- Verify the referenced endpoint resource actually runs and publishes its endpoint before the toolbox deploys.
- If using a custom/local endpoint, switch it to https or use the real Foundry project endpoint.
- Check the project's Endpoint reference in the AppHost — it must be set, not null.
Example fix
// before
var project = builder.AddAzureFoundryProject("foundry").WithEndpoint("http://localhost:8080");
// after
var project = builder.AddAzureFoundryProject("foundry").WithEndpoint("https://my-project.services.ai.azure.com"); Defensive patterns
Strategy: validation
Validate before calling
var ep = projectEndpointValue;
if (ep is null || !Uri.TryCreate(ep, UriKind.Absolute, out var uri) || uri.Scheme != "https") throw new InvalidOperationException($"Project endpoint must be absolute HTTPS, got: {ep}"); Type guard
static bool IsAbsoluteHttps(string? value) => Uri.TryCreate(value, UriKind.Absolute, out var u) && u.Scheme == Uri.UriSchemeHttps;
Try / catch
catch (InvalidOperationException ex) when (ex.Message.Contains("did not resolve to an absolute HTTPS endpoint")) { /* fix the project endpoint configuration */ } Prevention
- Always configure Foundry project resources with an https endpoint reference.
- Verify endpoint references resolve before deploy-time operations.
- Never point Foundry resources at http:// local addresses.
When it happens
Trigger: CreateAdministrationAsync reading Parent.Endpoint.GetValueAsync and getting null/empty, a relative URL, or an http:// URL — e.g., the project resource has no HTTPS endpoint defined, or the endpoint expression hasn't been evaluated yet at deploy time.
Common situations: The Foundry project was configured with only an http endpoint reference; the endpoint reference points at a resource that hasn't produced a value (missing connection string/endpoint configuration); a custom emulator URL using http instead of https.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- Endpoint ' ' is internal. Foundry hosted agents can only…
- A SearchIndexClient could not be configured. Ensure valid…
- Endpoint ' ' on resource ' ' is not exposed by the Azure…
- Endpoint ' ' on project resource ' ' is exposed through…
- Project ' ' does not have a valid endpoint.
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/e5f95ed8ada572a9.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Foundry/Toolbox/FoundryToolboxResource.cs:270
var definition = await CreateDeploymentDefinitionAsync(cancellationToken).ConfigureAwait(false);
var result = await new FoundryToolboxReconciler(administration)
.ReconcileAsync(definition, Version, cancellationToken).ConfigureAwait(false);
DeployedVersion.Set(result.Version);
return result;
}
private async Task<IFoundryToolboxAdministration> CreateAdministrationAsync(
PipelineStepContext context,
Action<string> logRetry,
CancellationToken cancellationToken)
{
var projectEndpoint = await Parent.Endpoint.GetValueAsync(cancellationToken).ConfigureAwait(false);
if (!Uri.TryCreate(projectEndpoint, UriKind.Absolute, out var endpoint) ||
endpoint.Scheme != Uri.UriSchemeHttps)
{
throw new InvalidOperationException(
$"Foundry project '{Parent.Name}' did not resolve to an absolute HTTPS endpoint.");
}
endpoint = new Uri(endpoint.GetLeftPart(UriPartial.Path).TrimEnd('/'));
var administration = context.Services.GetService<IFoundryToolboxAdministration>();
if (administration is null)
{
var credential = context.Services.GetRequiredService<ITokenCredentialProvider>().TokenCredential;
var clientOptions = new AIProjectClientOptions();
clientOptions.AddPolicy(new FoundryToolboxFeaturesPolicy(), PipelinePosition.PerCall);
var projectClient = new AIProjectClient(endpoint, credential, clientOptions);
administration = new AzureFoundryToolboxAdministration(
projectClient.AgentAdministrationClient.GetAgentToolboxes(),
logRetry);
}
return administration;View on GitHub (pinned to 25830f84bd)