{"record":{"id":"33ccca1aaac95a65","repo":"microsoft/aspire","slug":"sandbox-disk-image-diskimage-id-was-not-ready-after","errorCode":null,"errorMessage":"Sandbox disk image '{diskImage.Id}' was not ready after {DiskImageReadyTimeoutSeconds} seconds (last state: '{diskImage.Status.State}').","messagePattern":"Sandbox disk image '(.+?)' was not ready after (.+?) seconds \\(last state: '(.+?)'\\)\\.","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs","lineNumber":718,"sourceCode":"    {\n        var deadline = DateTimeOffset.UtcNow.AddSeconds(DiskImageReadyTimeoutSeconds);\n        while (DateTimeOffset.UtcNow < deadline)\n        {\n            if (IsDiskImageReady(diskImage))\n            {\n                return diskImage;\n            }\n\n            if (IsTerminalDiskImageFailure(diskImage))\n            {\n                throw CreateDiskImageFailureException(diskImage);\n            }\n\n            await Task.Delay(TimeSpan.FromSeconds(2), context.CancellationToken).ConfigureAwait(false);\n            diskImage = await client.GetDiskImageAsync(scope, diskImage.Id, context.CancellationToken).ConfigureAwait(false);\n        }\n\n        throw new TimeoutException($\"Sandbox disk image '{diskImage.Id}' was not ready after {DiskImageReadyTimeoutSeconds} seconds (last state: '{diskImage.Status.State}').\");\n    }\n\n    private static bool IsDiskImageReady(AzureDevComputeDiskImage diskImage) =>\n        string.Equals(diskImage.Status.State, \"Ready\", StringComparison.OrdinalIgnoreCase);\n\n    private static bool IsTerminalDiskImageFailure(AzureDevComputeDiskImage diskImage) =>\n        diskImage.Status.State.Contains(\"fail\", StringComparison.OrdinalIgnoreCase) ||\n        diskImage.Status.State.Contains(\"error\", StringComparison.OrdinalIgnoreCase);\n\n    internal static InvalidOperationException CreateDiskImageFailureException(AzureDevComputeDiskImage diskImage)\n    {\n        ArgumentNullException.ThrowIfNull(diskImage);\n        return new InvalidOperationException(\n            $\"Sandbox disk image '{diskImage.Id}' failed to become ready (terminal state: '{diskImage.Status.State}'). Service-provided error details were redacted.\");\n    }\n\n    private static Task<AzureDevComputeSandbox> CreateSandboxAsync(\n        PipelineStepContext context,","sourceCodeStart":700,"sourceCodeEnd":736,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs#L700-L736","documentation":"Before deploying a sandbox container from a disk image, Aspire polls the image until its status state becomes Ready, waiting up to DiskImageReadyTimeoutSeconds. If the image still is not ready when the timeout elapses, a TimeoutException is thrown reporting the last observed state.","triggerScenarios":"Calling the sandbox deployment path that uses a newly created AzureDevComputeDiskImage while the image is stuck in a non-Ready, non-terminal state (e.g. 'Creating'/'Pending') beyond DiskImageReadyTimeoutSeconds, with 2-second polling intervals.","commonSituations":"Large image builds under way during Azure capacity pressure, slow image replication in a new region, or a hung provisioning operation on the Azure side.","solutions":["Retry the deployment later — image creation is often just slow; the image may complete on its own.","Check the disk image's status/state in Azure to see whether it failed (terminal states are handled separately) or is still progressing.","Increase the wait budget if your images legitimately take longer, or pre-create/warm the image before deployment so it is Ready in advance."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await deployment.DeployAsync(...); }\ncatch (TimeoutException ex) when (ex.Message.Contains(\"was not ready after\"))\n{\n    // image build still in progress or hung; check Azure portal state,\n    // wait and retry with backoff, or pre-create the image\n}","preventionTips":["Pre-create disk images and wait for Ready before scheduling deployments.","Allow a larger time budget for large images or new regions.","Monitor image build status in Azure to distinguish slow from failed builds."],"tags":["azure","sandboxes","timeout","disk-image"],"backgroundTag":"request-timeout","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"}