EllanJiang/GameFramework · error · GameFrameworkException

File system ' ' is already exist.

Error message

File system '{0}' is already exist.

What it means

FileSystemManager.CreateFileSystem throws this when a file system mapped to the same normalized full path is already registered in the manager's internal dictionary. The manager only allows one live file system per physical path, so creating a duplicate is rejected with a GameFrameworkException. The path is normalized (Utility.Path.GetRegularPath) before the duplicate check, so differently-formatted but equivalent paths still collide.

Solutions

  1. Check HasFileSystem(fullPath) (or GetFileSystem) before creating, and reuse the existing IFileSystem instance.
  2. If a fresh file system is intended, call DestroyFileSystem(existing, deletePhysicalFile:false) first, then CreateFileSystem.
  3. Ensure only one code path initializes file systems (guard with an initialization flag).

Example fix

// before
var fs = fileSystemManager.CreateFileSystem(fullPath, FileSystemAccess.ReadWrite, 1024, 256);
// after
var fs = fileSystemManager.HasFileSystem(fullPath)
    ? fileSystemManager.GetFileSystem(fullPath)
    : fileSystemManager.CreateFileSystem(fullPath, FileSystemAccess.ReadWrite, 1024, 256);
Defensive patterns

Strategy: validation

Validate before calling

if (fileSystemManager.HasFileSystem(fullPath))
    return fileSystemManager.GetFileSystem(fullPath);
return fileSystemManager.CreateFileSystem(fullPath, FileSystemAccess.ReadWrite, maxFileCount, maxBlockCount);

Try / catch

try { fs = manager.CreateFileSystem(path, access, mc, mb); }
catch (GameFrameworkException ex) when (ex.Message.Contains("is already exist")) { fs = manager.GetFileSystem(path); }

Prevention

When it happens

Trigger: Calling FileSystemManager.CreateFileSystem(fullPath, access, maxFileCount, maxBlockCount) twice with the same fullPath (or a path that normalizes to the same string) without first calling DestroyFileSystem on the existing instance.

Common situations: Game initialization code run more than once (e.g. re-entering a scene that calls CreateFileSystem); creating a file system for a path that was already loaded via LoadFileSystem; passing paths with different casing/separator styles that normalize to the same entry.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/741aaced9ab931ff. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/FileSystem/FileSystemManager.cs:162

            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));
            }

            m_FileSystems.Add(fullPath, fileSystem);
            return fileSystem;
        }

View on GitHub (pinned to d0c010b051)