{"record":{"id":"30eb06ddf1e29429","repo":"microsoft/aspire","slug":"container-resource-name-container-name-conflicts-with-the","errorCode":null,"errorMessage":"Container resource name '{container.Name}' conflicts with the Aspire container tunnel container name '{ContainerTunnelContainerName}'. Rename the resource or disable the Aspire container tunnel.","messagePattern":"Container resource name '(.+?)' conflicts with the Aspire container tunnel container name '(.+?)'\\. Rename the resource or disable the Aspire container tunnel\\.","errorType":"exception","errorClass":"DistributedApplicationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dcp/ContainerCreator.cs","lineNumber":230,"sourceCode":"        if (resource.TryGetParentProcessLifetime(out var parentProcessId, out var parentProcessTimestamp))\n        {\n            spec.MonitorPid = parentProcessId;\n            spec.MonitorTimestamp = parentProcessTimestamp;\n        }\n    }\n\n    private void ValidateContainerTunnelContainerNameConflicts(IEnumerable<IResource> modelContainerResources)\n    {\n        if (!_options.Value.EnableAspireContainerTunnel)\n        {\n            return;\n        }\n\n        foreach (var container in modelContainerResources)\n        {\n            if (IsContainerTunnelContainerName(container.Name))\n            {\n                throw new DistributedApplicationException($\"Container resource name '{container.Name}' conflicts with the Aspire container tunnel container name '{ContainerTunnelContainerName}'. Rename the resource or disable the Aspire container tunnel.\");\n            }\n\n            if (container.TryGetLastAnnotation<ContainerNameAnnotation>(out var containerNameAnnotation) &&\n                IsContainerTunnelContainerName(containerNameAnnotation.Name))\n            {\n                throw new DistributedApplicationException($\"Container resource '{container.Name}' uses container name '{containerNameAnnotation.Name}', which conflicts with the Aspire container tunnel container name '{ContainerTunnelContainerName}'. Rename the container or disable the Aspire container tunnel.\");\n            }\n\n            foreach (var aliasAnnotation in container.Annotations.OfType<ContainerNetworkAliasAnnotation>())\n            {\n                if (IsContainerTunnelContainerName(aliasAnnotation.Alias))\n                {\n                    throw new DistributedApplicationException($\"Container resource '{container.Name}' uses network alias '{aliasAnnotation.Alias}', which conflicts with the Aspire container tunnel container name '{ContainerTunnelContainerName}'. Rename the alias or disable the Aspire container tunnel.\");\n                }\n            }\n        }\n\n        static bool IsContainerTunnelContainerName(string name)","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/ContainerCreator.cs#L212-L248","documentation":"Aspire reserves a special container name for its container tunnel feature. During DCP object preparation, every model container resource is checked and if its resource name matches the reserved tunnel container name (case-insensitive), startup fails with this DistributedApplicationException. The check exists because creating two containers with the same name would collide at the container runtime.","triggerScenarios":"Creating a container resource whose resource name equals the Aspire container tunnel container name (e.g. via AddContainer(name, ...) with the reserved name) while the container tunnel feature is enabled.","commonSituations":"Users naming a resource to match the tunnel container (copying infrastructure names), or code that generates container names that accidentally collide with the reserved tunnel name; only occurs when the container tunnel is enabled.","solutions":["Rename the container resource so it no longer matches the reserved tunnel container name","Disable the Aspire container tunnel feature if the name must be kept"],"exampleFix":"// before\nbuilder.AddContainer(\"aspire-container-tunnel\", \"image:tag\");\n// after\nbuilder.AddContainer(\"my-tunnel-sidecar\", \"image:tag\");","handlingStrategy":"validation","validationCode":"if (string.Equals(resource.Name, reservedTunnelContainerName, StringComparison.OrdinalIgnoreCase)) throw new InvalidOperationException($\"Resource name '{resource.Name}' conflicts with the reserved Aspire tunnel container name.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid naming resources with the reserved tunnel container name","Keep a project-wide naming convention/prefix for container resources","If you must keep the name, disable the Aspire container tunnel"],"tags":["containers","naming-conflict","startup"],"backgroundTag":"name-collision","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}