stride3d/stride · error · InvalidOperationException

Property path parse error: could not parse indexer value

Error message

Property path parse error: could not parse indexer value '{indexerName}'

What it means

ListUpdateResolver.ResolveIndexer parses the indexer segment of a property path into an integer list index and throws InvalidOperationException when parsing fails. Same mechanism as the array resolver but for List<T> members; the path must address list elements numerically.

Solutions

  1. Ensure the indexer is a plain integer: 'Points[2]'.
  2. Validate/normalize the path before Compile (int.TryParse each bracketed segment).
  3. Check that the target member is actually a list and the intended syntax; for dictionaries use the dictionary resolver path instead.
  4. Handle the InvalidOperationException at Compile time and surface the offending path in your own error message.

Example fix

// before
var path = $"Points[{indexName}]"; // indexName = 'last'
// after
var path = $"Points[{indexInt}]"; // indexInt = 0
Defensive patterns

Strategy: validation

Validate before calling

bool isValidListPath(string path) { var m = System.Text.RegularExpressions.Regex.Match(path, @"\[([^\]]*)\]"); return m.Success && int.TryParse(m.Groups[1].Value, out _); }

Try / catch

try { engine.Compile(target, path, ...); } catch (InvalidOperationException ex) when (ex.Message.Contains("indexer value")) { log.Error($"Invalid list indexer in path: {path}"); }

Prevention

When it happens

Trigger: Compiling a property path addressing a List<T> member with a non-integer indexer, e.g. 'Points[first]' or 'Points[]' via UpdateEngine.Compile / animation keys.

Common situations: Hand-written animation paths with symbolic indices; paths copied from dictionary-style bindings; generated paths where the index variable was empty or non-numeric at string-build time.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Engine/Updater/ListUpdateResolver.cs:23

using System.Globalization;

namespace Stride.Updater
{
    /// <summary>
    /// Resolver for <see cref="IList{T}"/> in property path.
    /// </summary>
    /// <typeparam name="T">The type of list items.</typeparam>
    public class ListUpdateResolver<T> : UpdateMemberResolver
    {
        public override Type SupportedType => typeof(IList<T>);

        /// <inheritdoc/>
        public override UpdatableMember ResolveIndexer(string indexerName)
        {
            // Transform index into integer
            int indexerValue;
            if (!int.TryParse(indexerName, NumberStyles.Any, CultureInfo.InvariantCulture, out indexerValue))
                throw new InvalidOperationException(string.Format("Property path parse error: could not parse indexer value '{0}'", indexerName));

            return new UpdatableListAccessor<T>(indexerValue);
        }
    }
}

View on GitHub (pinned to 96fad776d2)