EllanJiang/GameFramework · error · GameFrameworkException

Create file system ' ' failure.

Error message

Create file system '{0}' failure.

What it means

FileSystemManager.CreateFileSystem throws this when FileSystem.Create(fullPath, access, fileSystemStream, maxFileCount, maxBlockCount) returns null after a stream was successfully opened. FileSystem.Create only fails (returns null) when the stream helpers inside FileSystem (e.g. the header writer) cannot be created, indicating the file system instance could not be initialized on the newly created stream.

Solutions

  1. Use the built-in DefaultFileSystemHelper / default stream implementations so FileSystem.Create succeeds.
  2. If a custom FileSystemStream is used, verify it supports the read/write/seek operations FileSystem initialization requires.
  3. Check maxFileCount and maxBlockCount arguments are sane positive values accepted by the stream.

Example fix

// before
fileSystemStream = customHelper.CreateFileSystemStream(fullPath, access, true); // returns a stream FileSystem cannot use
// after
fileSystemStream = new DefaultFileSystemHelper().CreateFileSystemStream(fullPath, access, true);
Defensive patterns

Strategy: try-catch

Try / catch

try { fs = manager.CreateFileSystem(path, access, mc, mb); }
catch (GameFrameworkException ex) when (ex.Message.Contains("Create file system '")) { Log.Error("FileSystem.Create returned null; check stream/maxFileCount/maxBlockCount: " + ex.Message); }

Prevention

When it happens

Trigger: Calling CreateFileSystem where the underlying FileSystem.Create returns null - practically only when the internal FileSystemStreamHelper (operating on the supplied stream) fails to be created, e.g. an exotic custom FileSystemStream that the default header logic cannot handle.

Common situations: Custom IFileSystemStream implementations that return null from internal helper creation; corrupted or incompatible stream behavior when initializing a brand-new file system file.

Related errors


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

Appendix: source

Thrown at GameFramework/FileSystem/FileSystemManager.cs:174

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

        /// <summary>
        /// 加载文件系统。
        /// </summary>
        /// <param name="fullPath">要加载的文件系统的完整路径。</param>
        /// <param name="access">要加载的文件系统的访问方式。</param>
        /// <returns>加载的文件系统。</returns>
        public IFileSystem LoadFileSystem(string fullPath, FileSystemAccess access)
        {
            if (m_FileSystemHelper == null)
            {
                throw new GameFrameworkException("File system helper is invalid.");
            }

View on GitHub (pinned to d0c010b051)