{"record":{"id":"24aefd4dee646013","repo":"egametang/ET","slug":"invalid-vector-expected-3-coordinates-found-v-l","errorCode":null,"errorMessage":"Invalid vector, expected 3 coordinates, found {v.Length - 1}","messagePattern":"Invalid vector, expected 3 coordinates, found (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.recast/Scripts/Core/Share/Recast/ObjImporter.cs","lineNumber":86,"sourceCode":"\n        private static void ReadVertex(string line, ObjImporterContext context)\n        {\n            if (line.StartsWith(\"v \"))\n            {\n                float[] vert = ReadVector3f(line);\n                foreach (float vp in vert)\n                {\n                    context.vertexPositions.Add(vp);\n                }\n            }\n        }\n\n        private static float[] ReadVector3f(string line)\n        {\n            string[] v = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);\n            if (v.Length < 4)\n            {\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            }","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.recast/Scripts/Core/Share/Recast/ObjImporter.cs#L68-L104","documentation":"Thrown by ObjImporter.ReadVector3f when a vertex/normal line, after space-splitting, yields fewer than 4 tokens (the prefix token + 3 coordinates). The importer expects exactly three float coordinates; fewer means the OBJ line is malformed or truncated.","triggerScenarios":"An OBJ 'v' or 'vn' line with only one or two coordinates (e.g., 'v 1.0 2.0'); a line accidentally containing a non-space delimiter; extra empty tokens stripped by RemoveEmptyEntries leaving too few.","commonSituations":"Hand-edited or exporter-bugged OBJ files; 2D/planar exporters omitting one axis; whitespace corruption.","solutions":["Open the OBJ and locate the offending 'v'/'vn' line; supply the missing coordinate.","Re-export the mesh with a known-good exporter (e.g., Blender OBJ) that emits three axes.","Pre-scan the OBJ for vertex lines lacking three numeric tokens and report line numbers."],"exampleFix":"// before: line in file\nv 1.0 2.0\n\n// after\nv 1.0 2.0 0.0","handlingStrategy":"validation","validationCode":"// Pre-scan vertex lines for < 3 numeric coordinates.\nforeach (var line in lines)\n    if (line.StartsWith(\"v \") || line.StartsWith(\"vn \"))\n    {\n        var toks = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);\n        if (toks.Length < 4) throw new InvalidDataException($\"Bad OBJ line: {line}\");\n    }","typeGuard":"static bool IsValidVertexLine(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 vector\"))\n{ /* locate/fix the offending 'v' line in the source */ }","preventionTips":["Re-export the OBJ with three-axis vertices.","Pre-validate vertex lines for three coordinates.","Fix hand-edited OBJs that dropped an axis."],"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"}