{"record":{"id":"f68cc0cfdadc6e2d","repo":"microsoft/aspire","slug":"could-not-resolve-the-pushed-container-image-for-resource","errorCode":null,"errorMessage":"Could not resolve the pushed container image for resource '{resource.TargetResource.Name}'.","messagePattern":"Could not resolve the pushed container image for resource '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs","lineNumber":980,"sourceCode":"            {\n                EntraId = new AzureDevComputePortEntraIdAuthConfig\n                {\n                    Enabled = true,\n                    ObjectIds = [],\n                    TenantIds = []\n                }\n            };\n    }\n\n    private static async Task<string> ResolveContainerImageAsync(PipelineStepContext context, AzureSandboxContainerResource resource)\n    {\n        if (resource.TargetResource.RequiresImageBuildAndPush())\n        {\n            var containerImageReference = new ContainerImageReference(resource.TargetResource);\n            return await ((IValueProvider)containerImageReference)\n                .GetValueAsync(new ValueProviderContext { ExecutionContext = context.ExecutionContext, Caller = resource.TargetResource }, context.CancellationToken)\n                .ConfigureAwait(false)\n                ?? throw new InvalidOperationException($\"Could not resolve the pushed container image for resource '{resource.TargetResource.Name}'.\");\n        }\n\n        if (resource.TargetResource.TryGetContainerImageName(out var imageName))\n        {\n            return imageName;\n        }\n\n        throw new NotSupportedException($\"Resource '{resource.TargetResource.Name}' cannot be deployed to Azure sandbox group '{resource.Parent.Name}' because it does not produce or reference a container image.\");\n    }\n\n    private static async Task<string> ResolveContainerImageReferenceForDiskImageAsync(PipelineStepContext context, string imageReference)\n    {\n        var runtime = await ResolveContainerRuntimeAsync(context).ConfigureAwait(false);\n        return await ResolveContainerImageReferenceForDiskImageAsync(\n            runtime,\n            imageReference,\n            context.CancellationToken).ConfigureAwait(false);\n    }","sourceCodeStart":962,"sourceCodeEnd":998,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs#L962-L998","documentation":"When the target resource requires image build and push, the deployment resolves its pushed image reference via ContainerImageReference. If that value provider returns null, the deployment cannot determine what image to run in the sandbox and throws. The thrown object is the null-coalescing result, so the surfaced message is this string.","triggerScenarios":"Deploying a project/container resource whose TargetResource.RequiresImageBuildAndPush() is true, but the ContainerImageReference value provider yields null during GetValueAsync — typically because the image was never built/pushed (publish step skipped or failed) or the execution context lacks publish metadata.","commonSituations":"Running a sandbox deploy without a preceding container build/publish step; a failed or skipped push in the pipeline leaving no registry image; misconfigured registry so the push produced no reference; calling deploy in run-mode context where no push occurred.","solutions":["Ensure the deployment pipeline includes the image build-and-push steps before the sandbox deploy step and that they succeeded.","Verify the container registry configuration (registry URL, credentials) so the image can be pushed and referenced.","Run the deploy in publish mode with a valid execution context (aspire publish/deploy) rather than run mode.","If using a pre-built image, make the resource reference a concrete image name so RequiresImageBuildAndPush is not needed."],"exampleFix":"// before\naspire deploy --skip-build   // image never pushed, reference resolves to null\n\n// after\naspire publish && aspire deploy   // build/push completes first, ContainerImageReference resolves","handlingStrategy":"validation","validationCode":"if (resource.TargetResource.RequiresImageBuildAndPush())\n{\n    // Ensure publish/build steps ran before deploy\n    var pushed = await TryResolvePushedImageAsync(resource.TargetResource);\n    if (pushed is null) throw new InvalidOperationException(\"Run 'aspire publish' (build+push) before deploy.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run publish (build+push) before deploy in CI pipelines.","Verify registry credentials and configuration before deploying.","Check the push step's logs for silent failures."],"tags":["azure","containers","image","publish"],"backgroundTag":"resource-not-found","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"}