{"record":{"id":"7a75f09661cf2433","repo":"microsoft/aspire","slug":"project-project-name-does-not-have-a-valid-endpoint","errorCode":null,"errorMessage":"Project '{project.Name}' does not have a valid endpoint.","messagePattern":"Project '(.+?)' does not have a valid endpoint\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Foundry/PromptAgent/AzurePromptAgentResource.cs","lineNumber":205,"sourceCode":"\n        return Task.CompletedTask;\n    }\n\n    /// <summary>\n    /// Deploys the prompt agent to the given Microsoft Foundry project.\n    /// </summary>\n    private async Task<ProjectsAgentVersion> DeployAsync(\n        AzureCognitiveServicesProjectResource project,\n        PipelineStepContext context,\n        Action<string>? logRetry,\n        CancellationToken cancellationToken)\n    {\n        ArgumentNullException.ThrowIfNull(project);\n\n        var projectEndpoint = await project.Endpoint.GetValueAsync(cancellationToken).ConfigureAwait(false);\n        if (string.IsNullOrEmpty(projectEndpoint))\n        {\n            throw new InvalidOperationException($\"Project '{project.Name}' does not have a valid endpoint.\");\n        }\n\n        var tokenCredentialProvider = context.Services.GetRequiredService<ITokenCredentialProvider>();\n        var credential = tokenCredentialProvider.TokenCredential;\n\n        var options = await ToProjectsAgentVersionCreationOptionsAsync(cancellationToken).ConfigureAwait(false);\n        var projectClient = new AIProjectClient(new Uri(projectEndpoint), credential);\n\n        var retryPipeline = new ResiliencePipelineBuilder<ProjectsAgentVersion>()\n            .AddRetry(new RetryStrategyOptions<ProjectsAgentVersion>\n            {\n                Delay = s_projectEndpointReadinessDelay,\n                MaxRetryAttempts = ProjectEndpointReadinessMaxRetryAttempts,\n                ShouldHandle = new PredicateBuilder<ProjectsAgentVersion>()\n                    .Handle<ClientResultException>(IsProjectEndpointNotReady),\n                OnRetry = retry =>\n                {\n                    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}).\";","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Foundry/PromptAgent/AzurePromptAgentResource.cs#L187-L223","documentation":"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.","triggerScenarios":"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.","commonSituations":"Deploying before provisioning completes; infrastructure changes that renamed outputs; referencing the wrong project resource; Azure deployment errors upstream.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var endpoint = await project.Endpoint.GetValueAsync(ct); if (string.IsNullOrEmpty(endpoint)) { /* abort before deploying agent */ }","typeGuard":null,"tryCatchPattern":"try\n{\n    await agentResource.DeployAsync(ct);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"does not have a valid endpoint\"))\n{\n    logger.LogError(ex, \"Foundry project endpoint missing; ensure provisioning completed.\");\n    throw;\n}","preventionTips":["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."],"tags":["azure","foundry","deployment","endpoint","provisioning"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}