OrchardCMS/OrchardCore · error · FileStoreException
Cannot copy file ' ' to ' '.
Error message
Cannot copy file '{srcPath}' to '{dstPath}'. What it means
BlobFileStore.CopyFileAsync wraps any non-FileStoreException failure from the Azure Blob Storage SDK copy operation in a FileStoreException with this message. It signals the blob copy itself failed after argument validation (e.g. source blob missing or a storage service error). The inner exception carries the underlying Azure storage error.
Solutions
- Check the InnerException (RequestFailedException Status) to see the real Azure error: 404 means the source path is wrong, 403 means auth failed, 409/503 means throttling or conflict.
- Verify the source path exists with fileStore.GetFileInfoAsync(srcPath) before copying.
- Confirm the Azure Blob Storage connection string and container are correctly configured and the account is reachable.
- Ensure paths use forward slashes and contain only valid blob-name characters (no illegal Windows chars).
Example fix
// before
await fileStore.CopyFileAsync("media/old.jpg", "media/new.jpg");
// after
if (await fileStore.GetFileInfoAsync("media/old.jpg") == null)
{
throw new InvalidOperationException("Source file does not exist.");
}
await fileStore.CopyFileAsync("media/old.jpg", "media/new.jpg"); Defensive patterns
Strategy: try-catch
Validate before calling
var src = await fileStore.GetFileInfoAsync(srcPath);
if (src == null)
{
throw new InvalidOperationException($"Source '{srcPath}' does not exist.");
}
if (await fileStore.GetFileInfoAsync(dstPath) != null)
{
throw new InvalidOperationException($"Destination '{dstPath}' already exists.");
} Try / catch
try
{
await fileStore.CopyFileAsync(srcPath, dstPath);
}
catch (FileStoreException ex)
{
logger.LogError(ex.InnerException, "Copy failed from {Src} to {Dst}", srcPath, dstPath);
} Prevention
- Check source existence before copying
- Verify Azure Storage credentials and connectivity
- Use only valid blob-name characters in paths
- Retry transient (5xx/429) storage errors with backoff
When it happens
Trigger: Calling IFileStore.CopyFileAsync(srcPath, dstPath) when the source blob does not exist (RequestFailedException 404), when the destination path is invalid/contains illegal characters, or when the Azure Storage service rejects the StartCopy/Upload operation (quota, auth, throttling).
Common situations: Copies between media folders where the source was deleted or renamed by another request; bad storage account credentials or connection string; blob name characters invalid to Azure; storage service outages or throttling under load.
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
- Error retrieving file info for
- Error creating directory
- Error deleting file
- Cannot get file stream because the file
- Cannot get file stream of the file
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/1beacd1f8bc35bfc.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs:625
{
await Task.Delay(250);
// Need to fetch properties or CopyStatus will never update.
properties = await newBlob.GetPropertiesAsync();
}
if (properties.Value.CopyStatus != CopyStatus.Success)
{
throw new FileStoreException($"Error while copying file '{srcPath}'; copy operation failed with status {properties.Value.CopyStatus} and description {properties.Value.CopyStatusDescription}.");
}
}
catch (FileStoreException)
{
throw;
}
catch (Exception ex)
{
throw new FileStoreException($"Cannot copy file '{srcPath}' to '{dstPath}'.", ex);
}
}
public async Task<Stream> GetFileStreamAsync(string path)
{
try
{
var blob = GetBlobReference(path);
if (!await blob.ExistsAsync())
{
throw new FileStoreException($"Cannot get file stream because the file '{path}' does not exist.");
}
return (await blob.DownloadAsync()).Value.Content;
}
catch (FileStoreException)
{View on GitHub (pinned to 4306c0717f)