stride3d/stride · error · InvalidOperationException

Assets names cannot have empty spaces before or after the…

Error message

Assets names cannot have empty spaces before or after the name. Please rename [{0}] and compile again.

What it means

Data validation in ContentIndexMap.ReadEntries: a line in the asset index map file matched the entry pattern, but the regexSpace test found leading/trailing whitespace around the asset url. Asset names must not have surrounding spaces, so the corrupted entry aborts loading of the index map.

Solutions

  1. Open the index map file and remove leading/trailing spaces from the offending asset url
  2. Regenerate/recompile the index map so entries are written without whitespace
  3. Sanitize urls at asset-creation time to reject names containing surrounding spaces
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sources/core/Stride.Core.Serialization/Serialization/Contents/ContentIndexMap.cs:125 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/cd458faaf3ead0a3. Report an issue: GitHub.

Appendix: source

Thrown at sources/core/Stride.Core.Serialization/Serialization/Contents/ContentIndexMap.cs:125

        {
            line = line.Trim();
            if (line.Length == 0 || line.StartsWith('#'))
                continue;

            var match = regexEntry.Match(line);
            if (!match.Success)
            {
                throw new InvalidOperationException("Unable to read asset index entry [{0}]. Expecting: [path objectId]".ToFormat(line));
            }

            var url = match.Groups[1].Value;
            var objectIdStr = match.Groups[2].Value;

            // Test if the name has leading or ending spaces
            var matchSpace = regexEntrySpace.Match(line);
            if (matchSpace.Success && !matchSpace.Groups[1].Value.Equals(url))
            {
                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));
            }

            if (!ObjectId.TryParse(objectIdStr, out var objectId))
            {
                throw new InvalidOperationException("Unable to decode objectid [{0}] when reading asset index".ToFormat(objectIdStr));
            }

            var entry = new KeyValuePair<string, ObjectId>(url, objectId);
            entries.Add(entry);
        }
        return entries;
    }

    protected override void WriteEntry(Stream localStream, KeyValuePair<string, ObjectId> value)
    {
        ArgumentNullException.ThrowIfNull(localStream);

        var line = $"{value.Key} {value.Value}\n";

View on GitHub (pinned to 96fad776d2)