{"record":{"id":"a50e8ef95bddede5","repo":"egametang/ET","slug":"invalid-number-of-face-vertices-3-coordinates-exp","errorCode":null,"errorMessage":"Invalid number of face vertices: 3 coordinates expected, found {v.Length}","messagePattern":"Invalid number of face vertices: 3 coordinates expected, found (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.recast/Scripts/Core/Share/Recast/ObjImporter.cs","lineNumber":103,"sourceCode":"            {\n                throw new Exception(\"Invalid vector, expected 3 coordinates, found \" + (v.Length - 1));\n            }\n\n            // fix - https://github.com/ikpil/DotRecast/issues/7\n            return new float[]\n            {\n                float.Parse(v[1], CultureInfo.InvariantCulture), \n                float.Parse(v[2], CultureInfo.InvariantCulture), \n                float.Parse(v[3], CultureInfo.InvariantCulture)\n            };\n        }\n\n        private static void ReadFace(string line, ObjImporterContext context)\n        {\n            string[] v = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);\n            if (v.Length < 4)\n            {\n                throw new Exception(\"Invalid number of face vertices: 3 coordinates expected, found \" + v.Length);\n            }\n\n            for (int j = 0; j < v.Length - 3; j++)\n            {\n                context.meshFaces.Add(ReadFaceVertex(v[1], context));\n                for (int i = 0; i < 2; i++)\n                {\n                    context.meshFaces.Add(ReadFaceVertex(v[2 + j + i], context));\n                }\n            }\n        }\n\n        private static int ReadFaceVertex(string face, ObjImporterContext context)\n        {\n            string[] v = face.Split(\"/\");\n            return GetIndex(int.Parse(v[0]), context.vertexPositions.Count);\n        }\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.recast/Scripts/Core/Share/Recast/ObjImporter.cs#L85-L121","documentation":"Thrown by ObjImporter.ReadFace when a face ('f') line, after splitting, has fewer than 4 tokens — i.e., fewer than 3 vertex references. A valid polygonal face needs at least 3 vertices; the OBJ line is incomplete.","triggerScenarios":"An 'f' line with only two references (e.g., 'f 1 2'); a degenerate face; a face line truncated by editing/export.","commonSituations":"Malformed OBJs from broken exporters; manual edits that dropped a vertex index; edge-case meshes with degenerate faces.","solutions":["Find the offending 'f' line in the OBJ and ensure it lists at least 3 vertices.","Re-export the mesh from the source DCC tool.","Pre-validate that every 'f' line has >= 3 vertex references before importing."],"exampleFix":"// before\nf 1 2\n\n// after\nf 1 2 3","handlingStrategy":"validation","validationCode":"foreach (var line in lines)\n    if (line.StartsWith(\"f \"))\n    {\n        var t = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);\n        if (t.Length < 4) throw new InvalidDataException($\"Degenerate face: {line}\");\n    }","typeGuard":"static bool IsValidFaceLine(string line)\n{ var t = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); return t.Length >= 4; }","tryCatchPattern":"try { ObjImporter.Load(chunk); }\ncatch (Exception e) when (e.Message.Contains(\"Invalid number of face vertices\"))\n{ /* fix offending 'f' line */ }","preventionTips":["Ensure every 'f' line has >= 3 vertex references.","Re-export from the DCC tool.","Pre-validate face lines before import."],"tags":["recast","obj-import","parsing","validation"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}