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

ArrayUpdateResolver.ResolveIndexer converts a property-path indexer string (e.g. the '[3]' inside 'MyArray[3]') into an integer index and throws InvalidOperationException when the text is not parseable as an integer. This powers Stride's animation/scripting property path system, so the error means a malformed property path was compiled.

Solutions

  1. Use a numeric index in brackets for array members: 'FieldName[0]' not 'FieldName[name]'.
  2. Validate the generated property path string before compiling (regex like ^[A-Za-z_][\w]*(\[\d+\])*$).
  3. If you need keyed access, ensure the target member is a Dictionary with a matching blittable key type, not an array.
  4. Trim whitespace and ensure no empty brackets '[]' remain in the path.

Example fix

// before
var path = "Meshes[body]"; // non-numeric indexer for array
// after
var path = "Meshes[1]";
Defensive patterns

Strategy: validation

Validate before calling

bool isValidIndexer(string s) => int.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out _);

Try / catch

try { engine.Compile(myObject, path, ...); } catch (InvalidOperationException ex) when (ex.Message.Contains("indexer value")) { log.Error($"Bad property path: {path}"); }

Prevention

When it happens

Trigger: Compiling a property path (UpdateEngine.Compile / animation binding) whose indexer segment contains non-numeric text, e.g. 'Materials[color]' or 'Keys[first]' targeting an array member.

Common situations: Typos in animation/blender property paths; paths written for dictionaries (string keys) applied to arrays or lists; locale or whitespace issues inside the bracket; tooling that interpolates an empty or symbolic index into the path.

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/7df889108b024d57. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Engine/Updater/ArrayUpdateResolver.cs:21

using System;
using System.Globalization;

namespace Stride.Updater
{
    /// <summary>
    /// Resolver for <see cref="Array"/> with elements of type <typeparamref name="T"/>.
    /// </summary>
    /// <typeparam name="T">The type of array items.</typeparam>
    public class ArrayUpdateResolver<T> : UpdateMemberResolver
    {
        public override Type SupportedType => typeof(T[]);

        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));

            var updatableField = new UpdatableArrayAccessor<T>(indexerValue);

            return updatableField;
        }
    }
}

View on GitHub (pinned to 96fad776d2)