{"record":{"id":"bb1125c2d1263aa2","repo":"microsoft/ailab","slug":"file-file-does-not-exist-in-container-container","errorCode":null,"errorMessage":"file {file} does not exist in container {container}","messagePattern":"file (.+?) does not exist in container (.+?)","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"Sketch2Code/Sketch2Code.Core/Services/ObjectDetectionAppService.cs","lineNumber":297,"sourceCode":"\n            return detail;\n        }\n        public async Task<IList<CloudBlobContainer>> GetPredictionsAsync()\n        {\n            return await Task.Run(() => _cloudBlobClient.ListContainers().Where(l => l.Name != \"azure-webjobs-hosts\")\n                .OrderByDescending(c => c.Properties.LastModified).ToList());\n        }\n        public async Task<byte[]> GetFile(string container, string file)\n        {\n            var blobcontainer = _cloudBlobClient.GetContainerReference(container);\n            if (!await blobcontainer.ExistsAsync())\n            {\n                throw new ApplicationException($\"container {container} does not exist\");\n            }\n            var blob = blobcontainer.GetBlobReference(file);\n            if (!await blob.ExistsAsync())\n            {\n                throw new ApplicationException($\"file {file} does not exist in container {container}\");\n            }\n            using (var ms = new MemoryStream())\n            {\n                await blob.DownloadToStreamAsync(ms);\n                return ms.ToArray();\n            }\n        }\n        public async Task<T> GetFile<T>(string container, string file)\n        {\n            var data = await this.GetFile(container, file);\n            if (data == null) return default(T);\n            return JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(data));\n        }\n        public async Task<GroupBox> CreateGroupBoxAsync(IList<PredictedObject> predictedObjects)\n        {\n            var result = await Task.Run(() =>\n            {\n                //Project each prediction into its bounding box","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/microsoft/ailab/blob/89fe2fc62081145ec5408d42059cbcb7c4a033c8/Sketch2Code/Sketch2Code.Core/Services/ObjectDetectionAppService.cs#L279-L315","documentation":"GetFile validates its inputs before touching blob storage: it resolves the named container via CloudBlobClient.GetContainerReference and calls ExistsAsync; if the container (or the file blob within it, in the same guard block) is not present in the storage account, the method aborts with this error instead of returning null. It fires when a caller passes a container or file name that was deleted, never uploaded, or misspelled — the callers GetPredictionAsync, data, and content pass names derived from prediction results, so it typically means stale or absent prediction data.","triggerScenarios":"Thrown at Sketch2Code/Sketch2Code.Core/Services/ObjectDetectionAppService.cs:297 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the container and file names against containers/files actually listed by GetPredictionsAsync before calling GetFile","Check that the blob upload/prediction pipeline completed and the container still exists in the storage account","If the file may legitimately be absent, catch the exception (or pre-check blobcontainer.ExistsAsync) and return null or an empty result instead of surfacing the error","Correct any casing or typo in the container/file parameters, since blob names are case-sensitive"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"89fe2fc62081145ec5408d42059cbcb7c4a033c8","analyzedAt":"2026-09-13T20:10:53.835Z","contentChangedAt":"2026-09-13T20:10:53.835Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}