EllanJiang/GameFramework · error · GameFrameworkException
Access read is invalid.
Error message
Access read is invalid.
What it means
Validation in FileSystemManager.CreateFileSystem: thrown when access is FileSystemAccess.Read, because a newly created file system is being written to and read-only access is contradictory at creation time. Use Read only when opening an existing file system; create with Write (or ReadWrite as supported).
Solutions
- Use FileSystemAccess.ReadWrite (or Write) with CreateFileSystem; reserve Read for opening existing file systems.
- Restructure open-or-create logic: try Open with Read first, then Create with ReadWrite only if it does not exist.
- Map the access argument in wrapper code: force Read to ReadWrite (or reject) on the create path.
Example fix
// before var fs = fileSystemManager.CreateFileSystem(fullPath, FileSystemAccess.Read, 16, 1024); // throws // after var fs = fileSystemManager.CreateFileSystem(fullPath, FileSystemAccess.ReadWrite, 16, 1024);
Defensive patterns
Strategy: validation
Validate before calling
if (access == FileSystemAccess.Read)
access = FileSystemAccess.ReadWrite; // creation requires write capability
if (access == FileSystemAccess.Unspecified)
access = FileSystemAccess.ReadWrite; Type guard
static bool IsCreatableAccess(FileSystemAccess access) => access == FileSystemAccess.Write || access == FileSystemAccess.ReadWrite;
Try / catch
try { fileSystemManager.CreateFileSystem(fullPath, access, maxFileCount, maxBlockCount); }
catch (GameFrameworkException ex) when (ex.Message == "Access read is invalid.") { /* retry with ReadWrite or route to Open instead */ } Prevention
- Remember: Read is only valid when opening existing file systems, never when creating.
- In open-or-create wrappers, normalize the access mode on the create branch.
- Document and enforce with a helper method the rule 'Create => Write/ReadWrite only'.
When it happens
Trigger: Calling FileSystemManager.CreateFileSystem(fullPath, FileSystemAccess.Read, maxFileCount, maxBlockCount).
Common situations: Confusing Open (which accepts Read) with Create (which does not); reusing a Read access variable intended for opening existing file systems; generic open-or-create wrapper passing the caller's access straight through.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Access is invalid.
- File system is not writable.
- New name ' ' is too long.
- Full path is invalid.
- Data string is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/735c673198b4bd01.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/FileSystem/FileSystemManager.cs:156
{
if (m_FileSystemHelper == null)
{
throw new GameFrameworkException("File system helper is invalid.");
}
if (string.IsNullOrEmpty(fullPath))
{
throw new GameFrameworkException("Full path is invalid.");
}
if (access == FileSystemAccess.Unspecified)
{
throw new GameFrameworkException("Access is invalid.");
}
if (access == FileSystemAccess.Read)
{
throw new GameFrameworkException("Access read is invalid.");
}
fullPath = Utility.Path.GetRegularPath(fullPath);
if (m_FileSystems.ContainsKey(fullPath))
{
throw new GameFrameworkException(Utility.Text.Format("File system '{0}' is already exist.", fullPath));
}
FileSystemStream fileSystemStream = m_FileSystemHelper.CreateFileSystemStream(fullPath, access, true);
if (fileSystemStream == null)
{
throw new GameFrameworkException(Utility.Text.Format("Create file system stream for '{0}' failure.", fullPath));
}
FileSystem fileSystem = FileSystem.Create(fullPath, access, fileSystemStream, maxFileCount, maxBlockCount);
if (fileSystem == null)
{
throw new GameFrameworkException(Utility.Text.Format("Create file system '{0}' failure.", fullPath));View on GitHub (pinned to d0c010b051)