{"record":{"id":"3f7e8d3c054dbf1c","repo":"egametang/ET","slug":"invalid-version-header-version","errorCode":null,"errorMessage":"Invalid version {header.version}","messagePattern":"Invalid version (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.recast/Scripts/Core/Share/Detour/Io/DtMeshDataReader.cs","lineNumber":73,"sourceCode":"            header.magic = buf.GetInt();\n            if (header.magic != DtMeshHeader.DT_NAVMESH_MAGIC)\n            {\n                header.magic = IOUtils.SwapEndianness(header.magic);\n                if (header.magic != DtMeshHeader.DT_NAVMESH_MAGIC)\n                {\n                    throw new IOException(\"Invalid magic\");\n                }\n\n                buf.Order(buf.Order() == RcByteOrder.BIG_ENDIAN ? RcByteOrder.LITTLE_ENDIAN : RcByteOrder.BIG_ENDIAN);\n            }\n\n            header.version = buf.GetInt();\n            if (header.version != DtMeshHeader.DT_NAVMESH_VERSION)\n            {\n                if (header.version < DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_FIRST\n                    || header.version > DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_LAST)\n                {\n                    throw new IOException(\"Invalid version \" + header.version);\n                }\n            }\n\n            bool cCompatibility = header.version == DtMeshHeader.DT_NAVMESH_VERSION;\n            header.x = buf.GetInt();\n            header.y = buf.GetInt();\n            header.layer = buf.GetInt();\n            header.userId = buf.GetInt();\n            header.polyCount = buf.GetInt();\n            header.vertCount = buf.GetInt();\n            header.maxLinkCount = buf.GetInt();\n            header.detailMeshCount = buf.GetInt();\n            header.detailVertCount = buf.GetInt();\n            header.detailTriCount = buf.GetInt();\n            header.bvNodeCount = buf.GetInt();\n            header.offMeshConCount = buf.GetInt();\n            header.offMeshBase = buf.GetInt();\n            header.walkableHeight = buf.GetFloat();","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.recast/Scripts/Core/Share/Detour/Io/DtMeshDataReader.cs#L55-L91","documentation":"Thrown by DtMeshDataReader.Read when the mesh header version falls outside the supported recast4j range [DT_NAVMESH_VERSION_RECAST4J_FIRST, DT_NAVMESH_VERSION_RECAST4J_LAST] and is not the current DT_NAVMESH_VERSION. The file was written by a Detour/recast4j version this reader cannot interpret.","triggerScenarios":"Loading a tile mesh generated by a newer or older recast4j/DotRecast build than the runtime library; mixing outputs from different Detour forks.","commonSituations":"Updating the DotRecast package version after baking navmesh assets with the old version; consuming assets produced by a different Detour implementation.","solutions":["Re-bake/re-export navmesh data with the same DotRecast version the runtime uses.","Pin the asset-producing tool and the runtime to a compatible Detour version.","Check DtMeshHeader.DT_NAVMESH_VERSION against the version in the file before loading."],"exampleFix":"// before\nvar data = meshDataReader.Read(buf, nvp, is32Bit); // throws on old asset\n\n// after\n// re-export asset with current toolchain, then:\nvar data = meshDataReader.Read(buf, nvp, is32Bit);","handlingStrategy":"validation","validationCode":"int v = BitConverter.ToInt32(chunk, 4);\nbool ok = v == DtMeshHeader.DT_NAVMESH_VERSION ||\n          (v >= DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_FIRST &&\n           v <= DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_LAST);\nif (!ok) throw new InvalidDataException($\"Unsupported mesh version {v}\");","typeGuard":"static bool IsSupportedMeshVersion(int v)\n    => v == DtMeshHeader.DT_NAVMESH_VERSION ||\n       (v >= DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_FIRST &&\n        v <= DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_LAST);","tryCatchPattern":"try { var data = meshDataReader.Read(buf, nvp, is32Bit); }\ncatch (IOException e) when (e.Message.Contains(\"Invalid version\"))\n{ /* re-bake asset with matching toolchain */ }","preventionTips":["Keep the bake toolchain and runtime on the same Detour version.","Re-bake navmesh assets after package upgrades.","Version-check the header before loading."],"tags":["detour","io","version","file-format","migration"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}