EllanJiang/GameFramework · error · GameFrameworkException
Write resource ' ' to file system ' ' error.
Error message
Write resource '{0}' to file system '{1}' error. What it means
In the opposite move direction, when a CheckInfo has NeedMoveToFileSystem=true, RefreshCheckInfoStatus imports a loose disk file into a binary read-write file system via IFileSystem.WriteFile. If WriteFile returns false, the file could not be stored in the file system and this GameFrameworkException is thrown with the resource name and file system path.
Solutions
- Delete/repair the corrupted read-write file system (remove ReadWritePath contents) and let the update re-download everything.
- Confirm sufficient free storage on the device before running the update.
- Ensure the read-write version list and the actual files on disk come from the same resource version.
- Retry the whole CheckResources/UpdateResource flow once the environment is clean.
Example fix
// before // corrupted .dat file system -> WriteFile returns false -> throws // after: reset the read-write area if (Directory.Exists(readWritePath)) Directory.Delete(readWritePath, true); Directory.CreateDirectory(readWritePath); m_ResourceComponent.UpdateResourceAsync();
Defensive patterns
Strategy: try-catch
Validate before calling
if (new DriveInfo(Path.GetPathRoot(readWritePath)).AvailableFreeSpace < 128L * 1024 * 1024)
Debug.LogWarning("Insufficient storage for file-system move"); Try / catch
try { m_ResourceComponent.CheckResources(); }
catch (GameFrameworkException ex) when (ex.Message.StartsWith("Write resource"))
{
Debug.LogError($"File system write failed, resetting read-write data: {ex.Message}");
if (Directory.Exists(readWritePath)) Directory.Delete(readWritePath, true);
// re-run update to rebuild file systems
} Prevention
- Treat the read-write area as disposable: on corruption, delete and redownload.
- Check storage headroom before large updates.
- Avoid killing the app during the move phase to reduce file-system corruption.
When it happens
Trigger: RefreshCheckInfoStatus processes a CheckInfo with NeedMoveToFileSystem=true and fileSystem.WriteFile(resourceFullName, resourcePath) fails — the file system is corrupted, full, or cannot read the source disk file at resourcePath.
Common situations: Read-write file system (.dat) corrupted after abnormal app termination; disk quota/full storage on mobile; source file deleted or locked between the version-list check and the move; mixing file systems from different resource versions.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Save as file ' ' to ' ' from file system ' ' error.
- Offset is invalid.
- Length is invalid.
- String ' ' is too long.
- Full path is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/e81ab678174292be.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.ResourceChecker.cs:165
string resourceFullName = ci.ResourceName.FullName;
string resourcePath = Utility.Path.GetRegularPath(Path.Combine(m_ResourceManager.m_ReadWritePath, resourceFullName));
if (ci.NeedMoveToDisk)
{
IFileSystem fileSystem = m_ResourceManager.GetFileSystem(ci.ReadWriteFileSystemName, false);
if (!fileSystem.SaveAsFile(resourceFullName, resourcePath))
{
throw new GameFrameworkException(Utility.Text.Format("Save as file '{0}' to '{1}' from file system '{2}' error.", resourceFullName, resourcePath, fileSystem.FullPath));
}
fileSystem.DeleteFile(resourceFullName);
}
if (ci.NeedMoveToFileSystem)
{
IFileSystem fileSystem = m_ResourceManager.GetFileSystem(ci.FileSystemName, false);
if (!fileSystem.WriteFile(resourceFullName, resourcePath))
{
throw new GameFrameworkException(Utility.Text.Format("Write resource '{0}' to file system '{1}' error.", resourceFullName, fileSystem.FullPath));
}
if (File.Exists(resourcePath))
{
File.Delete(resourcePath);
}
}
}
m_ResourceManager.m_ResourceInfos.Add(ci.ResourceName, new ResourceInfo(ci.ResourceName, ci.FileSystemName, ci.LoadType, ci.Length, ci.HashCode, ci.CompressedLength, false, true));
m_ResourceManager.m_ReadWriteResourceInfos.Add(ci.ResourceName, new ReadWriteResourceInfo(ci.FileSystemName, ci.LoadType, ci.Length, ci.HashCode));
}
else if (ci.Status == CheckInfo.CheckStatus.Update)
{
m_ResourceManager.m_ResourceInfos.Add(ci.ResourceName, new ResourceInfo(ci.ResourceName, ci.FileSystemName, ci.LoadType, ci.Length, ci.HashCode, ci.CompressedLength, false, false));
updateCount++;
updateTotalLength += ci.Length;
updateTotalCompressedLength += ci.CompressedLength;View on GitHub (pinned to d0c010b051)