{"record":{"id":"818281bf88c73319","repo":"microsoft/aspire","slug":"service-svc-metadata-name-should-have-valid-address-at-this","errorCode":null,"errorMessage":"Service {svc.Metadata.Name} should have valid address at this point","messagePattern":"Service (.+?) should have valid address at this point","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dcp/DcpModelUtilities.cs","lineNumber":181,"sourceCode":"    {\n        var svc = sp.DcpResource;\n        var allocatedPort = svc.AllocatedPort ?? fallbackPort;\n\n        if (sp.EndpointAnnotation.AllocatedEndpoint is not null)\n        {\n            return true;\n        }\n\n        if (!svc.HasCompleteAddress && sp.EndpointAnnotation.IsProxied)\n        {\n            if (allowPending)\n            {\n                return false;\n            }\n\n            // This should never happen; if it does, we have a bug without a workaround for the user.\n            // We should have waited for the service to have a complete address before getting here.\n            throw new InvalidDataException($\"Service {svc.Metadata.Name} should have valid address at this point\");\n        }\n\n        if (!sp.EndpointAnnotation.IsProxied && allocatedPort is null)\n        {\n            if (allowPending)\n            {\n                return false;\n            }\n\n            throw new InvalidOperationException($\"Service '{svc.Metadata.Name}' needs to specify a port for endpoint '{sp.EndpointAnnotation.Name}' since it isn't using a proxy.\");\n        }\n\n        if (allocatedPort is null || string.IsNullOrEmpty(svc.AllocatedAddress))\n        {\n            if (allowPending)\n            {\n                return false;\n            }","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/DcpModelUtilities.cs#L163-L199","documentation":"This is an internal-invariant failure: DCP Service objects should always have a complete allocated address before this code runs, because the model builder waits for addresses before processing. A null/empty svc.AllocatedAddress here means an internal bug or race, not a user-actionable configuration problem.","triggerScenarios":"TryAddLocalhostAllocatedEndpoint is called (via TryAddWorkloadAllocatedEndpoints or ApplyServiceAddressToEndpoint) with allowPending=false while svc.AllocatedAddress is null/empty — i.e. the DCP Service was expected to have finished port allocation but did not.","commonSituations":"A slow or wedged DCP/docker environment where the service never completed allocation; a race where a resource was deleted or restarted mid-model-build; genuine Aspire/DCP bugs.","solutions":["Restart the AppHost and the Aspire environment (aspire run again) to reset DCP allocation state.","Check dashboard/DCP logs for the named Service to see why allocation never completed (e.g. port pool exhaustion, docker failure).","Update Aspire packages; if reproducible, file a bug — the code comments explicitly say 'we have a bug without a workaround'."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    await appHost.StartAsync();\n}\ncatch (InvalidDataException ex) when (ex.Message.Contains(\"should have valid address at this point\"))\n{\n    // restart DCP/AppHost; if reproducible, report an Aspire bug with DCP logs\n}","preventionTips":["Keep the container runtime and DCP healthy (restart docker if allocation stalls).","Avoid deleting/restarting resources while the AppHost model is still building.","Update Aspire packages regularly; this path is by-design unreachable."],"tags":["aspire","dcp","internal","address-allocation","invariant"],"backgroundTag":"internal-invariant-violation","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"}