{"record":{"id":"e678dbba27d43d47","repo":"OrchardCMS/OrchardCore","slug":"cannot-get-file-info-with-path-path","errorCode":null,"errorMessage":"Cannot get file info with path '{path}'.","messagePattern":"Cannot get file info with path '(.+?)'\\.","errorType":"exception","errorClass":"FileStoreException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs","lineNumber":195,"sourceCode":"\n    public async Task<IFileStoreEntry> GetFileInfoAsync(string path)\n    {\n        try\n        {\n            var blob = GetBlobReference(path);\n\n            var properties = await blob.GetPropertiesAsync();\n\n            return new BlobFile(path, properties.Value.ContentLength, properties.Value.LastModified);\n        }\n        catch (RequestFailedException ex) when (ex.ErrorCode == BlobErrorCode.BlobNotFound)\n        {\n            // Instead of ExistsAsync() check which is 'slow' if we're expecting to find the blob we rely on the exception.\n            return null;\n        }\n        catch (Exception ex)\n        {\n            throw new FileStoreException($\"Cannot get file info with path '{path}'.\", ex);\n        }\n    }\n\n    public async Task<IFileStoreEntry> GetDirectoryInfoAsync(string path)\n    {\n        await EnsureCapabilitiesAsync();\n\n        if (_capabilities?.HasHierarchicalNamespace == true)\n        {\n            try\n            {\n                if (path == string.Empty)\n                {\n                    return new BlobDirectory(path, _clock.UtcNow);\n                }\n\n                var prefix = this.Combine(_basePrefix, path);\n                var directoryClient = _dataLakeFileSystemClient.GetDirectoryClient(prefix);","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs#L177-L213","documentation":"BlobFileStore.GetFileInfoAsync deliberately avoids a slow ExistsAsync probe when it expects the blob to exist and instead relies on exceptions; any unexpected exception while fetching blob metadata is wrapped in a FileStoreException with this message. A 404 (blob not found) is treated as a normal null return, so this error means something other than a simple missing file went wrong.","triggerScenarios":"Calling GetFileInfoAsync(path) and the underlying GetBlobReference/properties request throws a non-404 exception — network failure, authentication failure, container missing, malformed path causing an invalid blob name, or an unexpected RequestFailedException status.","commonSituations":"Expired or wrong storage credentials (403) misread as 'file problem'; container deleted; DNS/proxy outages in Azure; path with illegal blob-name characters; transient Azure Storage throttling.","solutions":["Inspect the inner exception (ex.InnerException) to see the real status code — 403 means fix credentials/permissions, 404 would have returned null so it is not this error.","Validate the path exists and is a valid blob name before calling (call GetDirectoryInfoAsync or check for invalid characters).","Confirm the container exists and the connection string/account keys are valid and not rotated.","Retry on transient failures (503/timeouts) — Azure Storage throttling is common under load."],"exampleFix":"// before\nvar file = await fileStore.GetFileInfoAsync(userInputPath);\n// after\nif (string.IsNullOrWhiteSpace(userInputPath) || userInputPath.Contains('\"') || userInputPath.Contains(\"\\\\\"))\n{\n    return null; // reject invalid path up front\n}\nvar file = await fileStore.GetFileInfoAsync(userInputPath);","handlingStrategy":"try-catch","validationCode":"if (string.IsNullOrWhiteSpace(path) || path.Contains('\\\\') || path.Contains('\"'))\n{\n    return null; // invalid blob name; skip the call\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    var file = await fileStore.GetFileInfoAsync(path);\n    // file == null means not found (404 handled internally)\n}\ncatch (FileStoreException ex)\n{\n    logger.LogError(ex.InnerException, \"Blob metadata fetch failed for {Path}\", path);\n    // retry transient faults; otherwise surface a storage outage\n}","preventionTips":["Treat a null result as 'not found' — do not probe paths expected to throw 404s.","Sanitize user-supplied paths (replace backslashes, trim slashes, reject reserved characters).","Monitor for 403/401 to catch credential rotation early.","Enable retry policy for transient 5xx/timeout faults."],"tags":["azure","blob-storage","file-storage","network","resource-not-found"],"backgroundTag":"file-read-failed","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}