microsoft/aspire · error · InvalidOperationException
Project ' ' does not have a valid endpoint.
Error message
Project '{project.Name}' does not have a valid endpoint. What it means
During deployment, the prompt agent resolves its Foundry project's endpoint value (a provisioned output). If the endpoint reference resolves to null or empty, Aspire cannot construct the agents client and throws. This indicates the project resource was not provisioned to produce an endpoint output.
Solutions
- Check the Azure deployment logs for the Foundry project resource and fix any provisioning failures first.
- Ensure the agent references a project resource that actually produces an endpoint output.
- Re-run the deployment after provisioning completes (azd up / aspire publish then deploy).
- Verify ITokenCredentialProvider and project wiring are unchanged from the working sample.
Defensive patterns
Strategy: try-catch
Validate before calling
var endpoint = await project.Endpoint.GetValueAsync(ct); if (string.IsNullOrEmpty(endpoint)) { /* abort before deploying agent */ } Try / catch
try
{
await agentResource.DeployAsync(ct);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("does not have a valid endpoint"))
{
logger.LogError(ex, "Foundry project endpoint missing; ensure provisioning completed.");
throw;
} Prevention
- Ensure provisioning succeeds before deploying agents.
- Check deployment logs for the Foundry project resource when endpoints are empty.
- Keep the project resource wired as in the official samples so endpoint outputs are emitted.
When it happens
Trigger: DeployAsync on an AzurePromptAgentResource whose project's Endpoint output is empty — e.g. the Foundry project was not deployed, the deployment failed, or the endpoint reference points at a resource that produces no endpoint output.
Common situations: Deploying before provisioning completes; infrastructure changes that renamed outputs; referencing the wrong project resource; Azure deployment errors upstream.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- Azure sandbox endpoint
- Deployment failed
- Endpoint ' ' is internal. Foundry hosted agents can only…
- Failed to resolve connection ID for Azure AI Search tool
- Failed to resolve connection ID for Azure AI Search tool
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/7a75f09661cf2433.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Foundry/PromptAgent/AzurePromptAgentResource.cs:205
return Task.CompletedTask;
}
/// <summary>
/// Deploys the prompt agent to the given Microsoft Foundry project.
/// </summary>
private async Task<ProjectsAgentVersion> DeployAsync(
AzureCognitiveServicesProjectResource project,
PipelineStepContext context,
Action<string>? logRetry,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(project);
var projectEndpoint = await project.Endpoint.GetValueAsync(cancellationToken).ConfigureAwait(false);
if (string.IsNullOrEmpty(projectEndpoint))
{
throw new InvalidOperationException($"Project '{project.Name}' does not have a valid endpoint.");
}
var tokenCredentialProvider = context.Services.GetRequiredService<ITokenCredentialProvider>();
var credential = tokenCredentialProvider.TokenCredential;
var options = await ToProjectsAgentVersionCreationOptionsAsync(cancellationToken).ConfigureAwait(false);
var projectClient = new AIProjectClient(new Uri(projectEndpoint), credential);
var retryPipeline = new ResiliencePipelineBuilder<ProjectsAgentVersion>()
.AddRetry(new RetryStrategyOptions<ProjectsAgentVersion>
{
Delay = s_projectEndpointReadinessDelay,
MaxRetryAttempts = ProjectEndpointReadinessMaxRetryAttempts,
ShouldHandle = new PredicateBuilder<ProjectsAgentVersion>()
.Handle<ClientResultException>(IsProjectEndpointNotReady),
OnRetry = retry =>
{
var retryMessage = $"Foundry project endpoint for '{project.Name}' is not ready yet. Retrying prompt agent deployment in {s_projectEndpointReadinessDelay.TotalSeconds:n0} seconds ({retry.AttemptNumber + 1}/{ProjectEndpointReadinessMaxRetryAttempts}).";View on GitHub (pinned to 25830f84bd)