OrchardCMS/OrchardCore · error · FileStoreException
Cannot get directory info with path
Error message
Cannot get directory info with path '{path}'. What it means
In BlobFileStore.GetDirectoryInfoAsync, the blob-client path wraps non-404 exceptions in a FileStoreException with this message; a 404 (RequestFailedException with Status==404) is deliberately treated as 'directory does not exist' and returns null. So this error signals an unexpected failure — not a simple missing directory — while resolving the blob 'directory' for the given path.
Solutions
- Read the inner exception for the true cause (403 auth vs 503 throttling vs invalid name).
- Sanitize/validate the path (no '\\', no reserved characters) before calling GetDirectoryInfoAsync.
- Verify the container and storage credentials are correct and the account is reachable.
- Handle a null return as 'not found' instead of probing with malformed paths that can throw.
Example fix
// before
var dir = await fileStore.GetDirectoryInfoAsync(folderName.Replace('/', '\\'));
// after
var normalized = folderName.Replace('\\', '/').Trim('/');
var dir = await fileStore.GetDirectoryInfoAsync(normalized);
if (dir == null) { /* directory does not exist */ } Defensive patterns
Strategy: validation
Validate before calling
var normalized = (path ?? string.Empty).Replace('\\', '/').Trim('/');
if (normalized.Split('/', StringSplitOptions.RemoveEmptyEntries).Any(string.IsNullOrWhiteSpace))
{
return null; // invalid directory path
} Try / catch
try
{
var dir = await fileStore.GetDirectoryInfoAsync(normalized);
if (dir == null) { /* not found — normal case */ }
}
catch (FileStoreException ex)
{
logger.LogError(ex.InnerException, "Directory lookup failed for {Path}", normalized);
} Prevention
- Normalize paths before every BlobFileStore call.
- Distinguish 404-as-null from real failures by checking InnerException status codes.
- Keep container names and credentials validated at startup.
- Wrap repeated lookups in a resilience policy (Polly-style retry).
When it happens
Trigger: Calling GetDirectoryInfoAsync(path) where the underlying blob/directory query throws a non-404 exception: invalid characters in path yielding an invalid blob prefix, network/auth failure, container gone, or unexpected service error.
Common situations: Paths containing backslashes or reserved characters; misconfigured container name; credential rotation mid-flight; transient Azure outages; passing a file path where callers assumed directory semantics plus a coincidental service failure.
Related errors
- Cannot get file info with path
- Cannot get directory content with path
- Cannot create directory
- Cannot create directory because the path
- Cannot delete file ' '.
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/e03959ed279820f8.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs:228
}
var prefix = this.Combine(_basePrefix, path);
var directoryClient = _dataLakeFileSystemClient.GetDirectoryClient(prefix);
if (await directoryClient.ExistsAsync())
{
return new BlobDirectory(path, _clock.UtcNow);
}
return null;
}
catch (RequestFailedException ex) when (ex.Status == 404)
{
return null;
}
catch (Exception ex)
{
throw new FileStoreException($"Cannot get directory info with path '{path}'.", ex);
}
}
try
{
if (path == string.Empty)
{
return new BlobDirectory(path, _clock.UtcNow);
}
var blobDirectory = await GetBlobDirectoryReference(path);
if (blobDirectory != null)
{
return new BlobDirectory(path, _clock.UtcNow);
}
return null;View on GitHub (pinned to 4306c0717f)