peass-ng/PEASS-ng · error · InvalidOperationException

Mismatching Id for trigger and lookup.

Error message

Mismatching Id for trigger and lookup.

What it means

Lookup-failure sentinel in the TriggerCollection string indexer's getter: after iterating all triggers, none has an Id equal to the requested triggerId, so the generic ArgumentOutOfRangeException(nameof(triggerId)) is thrown — the message 'Mismatching Id for trigger and lookup.' documents the intent. The faulting input is the triggerId string; the empty/null case is caught earlier by a separate ArgumentNullException.

Source

Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TriggerCollection.cs:77

        public Trigger this[[NotNull] string triggerId]
        {
            get
            {
                if (string.IsNullOrEmpty(triggerId))
                    throw new ArgumentNullException(nameof(triggerId));
                foreach (var t in this)
                    if (string.Equals(t.Id, triggerId))
                        return t;
                throw new ArgumentOutOfRangeException(nameof(triggerId));
            }
            set
            {
                if (value == null)
                    throw new NullReferenceException();
                if (string.IsNullOrEmpty(triggerId))
                    throw new ArgumentNullException(nameof(triggerId));
                if (triggerId != value.Id)
                    throw new InvalidOperationException("Mismatching Id for trigger and lookup.");
                var index = IndexOf(triggerId);
                if (index >= 0)
                {
                    var orig = this[index].Clone();
                    inV2set = true;
                    try
                    {
                        RemoveAt(index);
                        Insert(index, value);
                    }
                    finally
                    {
                        inV2set = true;
                    }
                    OnNotifyPropertyChanged(IndexerName);
                    CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, value, orig, index));
                }
                else

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Verify the trigger exists first via Contains or by enumerating Ids before indexing by Id
  2. Ensure the Id assigned on the Trigger (its Id property) matches the string passed to the indexer
  3. Catch ArgumentOutOfRangeException and treat it as 'trigger not found' when doing lookup-style access
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TriggerCollection.cs:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/dcbd856d3e1ede37. Report an issue: GitHub.