{"record":{"id":"c2531c22632be155","repo":"microsoft/aspire","slug":"result-errormessage-container-runtime-failed-to-inspect-c2531c","errorCode":null,"errorMessage":"result.ErrorMessage ?? \"Container runtime failed to inspect image configuration '{imageReference}'.\"","messagePattern":"result\\.ErrorMessage \\?\\? \"Container runtime failed to inspect image configuration '(.+?)'\\.\"","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs","lineNumber":1117,"sourceCode":"    }\n\n    internal static bool HasModeledCommandConfiguration(IResource resource) =>\n        resource is ContainerResource { Entrypoint: { Length: > 0 } } ||\n        resource.TryGetAnnotationsOfType<CommandLineArgsCallbackAnnotation>(out var callbacks) && callbacks.Any();\n\n    private static async Task<ContainerImageMetadata> InspectLocalContainerImageAsync(PipelineStepContext context, string imageReference)\n    {\n        var runtime = await ResolveContainerRuntimeAsync(context).ConfigureAwait(false);\n        var result = await runtime.InspectImageConfigAsync(imageReference, context.CancellationToken).ConfigureAwait(false);\n        if (result.Status == ContainerImageInspectionStatus.Unsupported)\n        {\n            throw new NotSupportedException(\n                $\"Container runtime '{runtime.Name}' does not support image configuration inspection, which is required for Azure sandbox deployment.\");\n        }\n\n        if (result.Status == ContainerImageInspectionStatus.Failed)\n        {\n            throw new InvalidOperationException(\n                result.ErrorMessage ?? $\"Container runtime failed to inspect image configuration '{imageReference}'.\");\n        }\n\n        if (!result.TryGetConfig(out var config))\n        {\n            throw new InvalidOperationException($\"Container runtime did not return image configuration for '{imageReference}'.\");\n        }\n\n        return new ContainerImageMetadata(\n            config.Entrypoint,\n            config.Command,\n            new Dictionary<string, string>(StringComparer.Ordinal),\n            config.WorkingDirectory,\n            new HashSet<string>(StringComparer.OrdinalIgnoreCase));\n    }\n\n    private static Task<IContainerRuntime> ResolveContainerRuntimeAsync(PipelineStepContext context)\n    {","sourceCodeStart":1099,"sourceCodeEnd":1135,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs#L1099-L1135","documentation":"When InspectImageConfigAsync returns Status == Failed, the integration throws InvalidOperationException using the runtime-provided ErrorMessage when available, otherwise this fallback message. The inspection command executed but the runtime reported an error obtaining the image configuration.","triggerScenarios":"The runtime's image config inspection fails for the resolved reference — image not present locally and pull fails, registry authentication errors, corrupted local image store, or the tag/digest was removed between manifest and config inspection.","commonSituations":"Unauthenticated access to a private registry; image garbage-collected locally mid-deployment; registry outage or rate limit; image tag retagged/deleted after a previous successful inspection.","solutions":["Run `docker image inspect <image>` manually to reproduce and see the underlying runtime error.","Authenticate to the registry (docker login) and retry the deployment.","Pre-pull the image (docker pull <image>) to ensure it exists locally with a valid config.","Check registry status/network and, if the local store is corrupted, prune and re-pull the image."],"exampleFix":"// before (shell)\naspire deploy   # config inspect fails: image not found locally\n\n// after\ndocker login myregistry.azurecr.io\ndocker pull myregistry.azurecr.io/myapp:latest\naspire deploy","handlingStrategy":"try-catch","validationCode":"var proc = await Process.RunAsync(\"docker\", \"pull <image>\");\nif (proc.ExitCode != 0) throw new InvalidOperationException($\"Image pull failed: {proc.Output}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await DeployToSandboxAsync(...);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"failed to inspect image configuration\"))\n{\n    logger.LogError(ex, \"Image config inspection failed; re-authenticate and pre-pull the image.\");\n    throw;\n}","preventionTips":["docker login before deployment.","Pre-pull the image so local state is valid.","Watch for tag deletions/retags between pipeline steps."],"tags":["containers","docker","registry","image"],"backgroundTag":"http-error-response","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"}