egametang/ET · error · Exception
{e.Message}
Error message
{e.Message} What it means
In ObjImporter, the chunk-parsing loop catches any exception thrown by ReadLine and re-throws it as a new Exception wrapping only e.Message (with the original as inner). The surfaced message is therefore the underlying parse error (e.g., invalid vector, bad face index, or a numeric parse failure). It is a generic wrapper; the real cause is in the inner exception or the message text.
Source
Thrown at Packages/cn.etetet.recast/Scripts/Core/Share/Recast/ObjImporter.cs:50
return new SimpleInputGeomProvider(context.vertexPositions, context.meshFaces);
}
public static ObjImporterContext LoadContext(byte[] chunk)
{
ObjImporterContext context = new ObjImporterContext();
try
{
using StreamReader reader = new StreamReader(new MemoryStream(chunk));
string line;
while ((line = reader.ReadLine()) != null)
{
line = line.Trim();
ReadLine(line, context);
}
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return context;
}
public static void ReadLine(string line, ObjImporterContext context)
{
if (line.StartsWith("v"))
{
ReadVertex(line, context);
}
else if (line.StartsWith("f"))
{
ReadFace(line, context);
}
}
View on GitHub (pinned to 5cab01f7a8)
Solutions
- Inspect the inner exception / message text to identify the offending OBJ line and fix the source file.
- Validate the OBJ syntax (v/f lines) before importing.
- Pre-check that the stream is actually OBJ text and not empty/binary.
- Use invariant-culture parsing at the call site to avoid locale-driven float errors.
Example fix
// before
var ctx = ObjImporter.Load(chunk); // bubbles {e.Message}
// after
try { var ctx = ObjImporter.Load(chunk); }
catch (Exception ex)
{
Debug.LogError($"OBJ import failed: {ex.Message} (inner: {ex.InnerException?.Message})");
// fix the offending line in the OBJ source
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check stream is non-empty text starting with a known OBJ token.
using var ms = new MemoryStream(chunk);
using var sr = new StreamReader(ms);
string first = sr.ReadLine() ?? "";
if (!first.StartsWith("#") && !first.StartsWith("v") && !first.StartsWith("f") && !first.StartsWith("o"))
throw new InvalidDataException("Not an OBJ stream"); Type guard
static bool LooksLikeObj(byte[] chunk)
{ try { var s = System.Text.Encoding.ASCII.GetString(chunk, 0, Math.Min(64, chunk.Length)); return s.Contains("v ") || s.Contains("f ") || s.StartsWith("#"); } catch { return false; } } Try / catch
try { var ctx = ObjImporter.Load(chunk); }
catch (Exception e)
{ Debug.LogError($"OBJ parse failed: {e.Message}; inner: {e.InnerException?.Message}"); throw; } Prevention
- Inspect the inner exception / message to find the offending OBJ line.
- Validate OBJ syntax before importing.
- Confirm float tokens are locale-independent (invariant culture).
- Re-export OBJs from a reliable DCC tool.
When it happens
Trigger: Loading an OBJ file with malformed geometry lines (bad vertex coords, invalid face indices, non-numeric tokens); feeding a non-OBJ stream to the OBJ importer.
Common situations: Importing artist-authored OBJs with formatting quirks; corrupted/edited OBJ files; locale-dependent float parsing issues in downstream ReadVector3f.
Related errors
- Invalid vector, expected 3 coordinates, found {v.Length - 1}
- Invalid number of face vertices: 3 coordinates expected, fou
- 0 vertex index
- condition number parse error: {text}
- condition token error at {this.index}: {c}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/f8859c4deb3da034.
Report an issue: GitHub.