OrchardCMS/OrchardCore · error · FileStoreException

Cannot get file info with path

Error message

Cannot get file info with path '{path}'.

What it means

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.

Solutions

  1. 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.
  2. Validate the path exists and is a valid blob name before calling (call GetDirectoryInfoAsync or check for invalid characters).
  3. Confirm the container exists and the connection string/account keys are valid and not rotated.
  4. Retry on transient failures (503/timeouts) — Azure Storage throttling is common under load.

Example fix

// before
var file = await fileStore.GetFileInfoAsync(userInputPath);
// after
if (string.IsNullOrWhiteSpace(userInputPath) || userInputPath.Contains('"') || userInputPath.Contains("\\"))
{
    return null; // reject invalid path up front
}
var file = await fileStore.GetFileInfoAsync(userInputPath);
Defensive patterns

Strategy: try-catch

Validate before calling

if (string.IsNullOrWhiteSpace(path) || path.Contains('\\') || path.Contains('"'))
{
    return null; // invalid blob name; skip the call
}

Try / catch

try
{
    var file = await fileStore.GetFileInfoAsync(path);
    // file == null means not found (404 handled internally)
}
catch (FileStoreException ex)
{
    logger.LogError(ex.InnerException, "Blob metadata fetch failed for {Path}", path);
    // retry transient faults; otherwise surface a storage outage
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13). Data as JSON: /api/errors/e678dbba27d43d47. Report an issue: GitHub.

Appendix: source

Thrown at src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs:195

    public async Task<IFileStoreEntry> GetFileInfoAsync(string path)
    {
        try
        {
            var blob = GetBlobReference(path);

            var properties = await blob.GetPropertiesAsync();

            return new BlobFile(path, properties.Value.ContentLength, properties.Value.LastModified);
        }
        catch (RequestFailedException ex) when (ex.ErrorCode == BlobErrorCode.BlobNotFound)
        {
            // Instead of ExistsAsync() check which is 'slow' if we're expecting to find the blob we rely on the exception.
            return null;
        }
        catch (Exception ex)
        {
            throw new FileStoreException($"Cannot get file info with path '{path}'.", ex);
        }
    }

    public async Task<IFileStoreEntry> GetDirectoryInfoAsync(string path)
    {
        await EnsureCapabilitiesAsync();

        if (_capabilities?.HasHierarchicalNamespace == true)
        {
            try
            {
                if (path == string.Empty)
                {
                    return new BlobDirectory(path, _clock.UtcNow);
                }

                var prefix = this.Combine(_basePrefix, path);
                var directoryClient = _dataLakeFileSystemClient.GetDirectoryClient(prefix);

View on GitHub (pinned to 4306c0717f)