{"record":{"id":"09951f15720161a3","repo":"stride3d/stride","slug":"unable-to-read-asset-index-entry-0-expecting-path-objectid","errorCode":null,"errorMessage":"Unable to read asset index entry [{0}]. Expecting: [path objectId]","messagePattern":"Unable to read asset index entry \\[(.+?)\\]\\. Expecting: \\[path objectId\\]","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Serialization/Serialization/Contents/ContentIndexMap.cs","lineNumber":115,"sourceCode":"        }\n    }\n\n    protected override List<KeyValuePair<string, ObjectId>> ReadEntries(Stream localStream)\n    {\n        ArgumentNullException.ThrowIfNull(localStream);\n\n        var reader = new StreamReader(localStream, Encoding.UTF8);\n        var entries = new List<KeyValuePair<string, ObjectId>>();\n        while (reader.ReadLine() is { } line)\n        {\n            line = line.Trim();\n            if (line.Length == 0 || line.StartsWith('#'))\n                continue;\n\n            var match = regexEntry.Match(line);\n            if (!match.Success)\n            {\n                throw new InvalidOperationException(\"Unable to read asset index entry [{0}]. Expecting: [path objectId]\".ToFormat(line));\n            }\n\n            var url = match.Groups[1].Value;\n            var objectIdStr = match.Groups[2].Value;\n\n            // Test if the name has leading or ending spaces\n            var matchSpace = regexEntrySpace.Match(line);\n            if (matchSpace.Success && !matchSpace.Groups[1].Value.Equals(url))\n            {\n                throw new InvalidOperationException(\"Assets names cannot have empty spaces before or after the name. Please rename [{0}] and compile again.\".ToFormat(matchSpace.Groups[1].Value));\n            }\n\n            if (!ObjectId.TryParse(objectIdStr, out var objectId))\n            {\n                throw new InvalidOperationException(\"Unable to decode objectid [{0}] when reading asset index\".ToFormat(objectIdStr));\n            }\n\n            var entry = new KeyValuePair<string, ObjectId>(url, objectId);","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Serialization/Serialization/Contents/ContentIndexMap.cs#L97-L133","documentation":"ContentIndexMap.ReadEntries parses a text index file where every non-comment line must match the pattern 'path objectId' (matched by regexEntry). A line that does not match means the index file is malformed, so ReadEntries throws InvalidOperationException naming the offending line.","triggerScenarios":"A truncated or hand-edited index file; a line with missing ObjectId, extra fields, or an unescaped path containing the separator; output written by an incompatible older/newer format.","commonSituations":"Crash or disk-full left a partial last line; manual editing of the .idx file; merging index files from different Stride versions.","solutions":["Open the index file and fix or remove the malformed line so it reads 'path objectId'","Restore the index file from backup or regenerate it by re-saving the assets/package","Check for a trailing partial line from an interrupted write and delete it"],"exampleFix":"// before (index file)\nassets/myasset\n# missing objectId\n// after\nassets/myasset 0123456789abcdef0123456789abcdef","handlingStrategy":"try-catch","validationCode":"static bool IsValidIndexLine(string line, Regex regexEntry) =>\n    line.Length == 0 || line.StartsWith('#') || regexEntry.IsMatch(line);","typeGuard":null,"tryCatchPattern":"try { contentIndexMap.Load(); }\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Unable to read asset index entry\"))\n{\n    Log.Error(ex, \"Corrupt index file; regenerating from source assets\");\n    // rebuild or restore the index\n}","preventionTips":["Never hand-edit index files; use library APIs to modify them","Validate/backup the index before large operations","Handle crash recovery by truncating partial trailing lines","Keep index format consistent across Stride versions"],"tags":["parsing","serialization","index-file"],"backgroundTag":"schema-validation-failed","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}