EllanJiang/GameFramework · error · GameFrameworkException

Can not parse data row bytes for data table

Error message

Can not parse data row bytes for data table '{0}' with exception '{1}'.

What it means

Wrapping error thrown by DataTable<T>.AddDataRow(byte[]) when parsing the raw data row bytes fails with a non-GameFrameworkException. The message includes the table identity (row type + name) and the inner exception, which is preserved as InnerException.

Solutions

  1. Check InnerException for the root cause.
  2. Re-download/rebuild the data asset; verify file integrity.
  3. Confirm the byte layout/encoding matches what the data provider expects.
  4. Keep the row class and data export pipeline in the same version.

Example fix

// before
byte[] data = File.ReadAllBytes(path); // file truncated by bad download
table.AddDataRow(data);
// after
byte[] data = File.ReadAllBytes(path);
// verify checksum / length before parsing
table.AddDataRow(data);
Defensive patterns

Strategy: try-catch

Validate before calling

if (dataRow == null || dataRow.Length == 0) throw new InvalidDataException("Empty data row bytes");

Try / catch

try { table.AddDataRow(bytes); } catch (GameFrameworkException ex) { var root = ex.InnerException; Log.Error($"Bad byte row for {table.Name}: {root}"); }

Prevention

When it happens

Trigger: Calling AddDataRow(byte[] dataRow) with bytes that the data provider cannot deserialize into T — corrupt data, wrong encoding, truncated buffer, or an exception thrown inside the parse helper.

Common situations: Resource files corrupted or partially downloaded; wrong encryption offset; version mismatch between serialized bytes and the row class; binary data built for a different table.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/DataTable/DataTableManager.DataTable.cs:425

                try
                {
                    T dataRow = new T();
                    if (!dataRow.ParseDataRow(dataRowBytes, startIndex, length, userData))
                    {
                        return false;
                    }

                    InternalAddDataRow(dataRow);
                    return true;
                }
                catch (Exception exception)
                {
                    if (exception is GameFrameworkException)
                    {
                        throw;
                    }

                    throw new GameFrameworkException(Utility.Text.Format("Can not parse data row bytes for data table '{0}' with exception '{1}'.", new TypeNamePair(typeof(T), Name), exception), exception);
                }
            }

            /// <summary>
            /// 移除指定数据表行。
            /// </summary>
            /// <param name="id">要移除数据表行的编号。</param>
            /// <returns>是否移除数据表行成功。</returns>
            public override bool RemoveDataRow(int id)
            {
                if (!HasDataRow(id))
                {
                    return false;
                }

                if (!m_DataSet.Remove(id))
                {
                    return false;

View on GitHub (pinned to d0c010b051)