peass-ng/PEASS-ng · error · ArgumentOutOfRangeException
Failed to remove action. Index out of range.
Error message
Failed to remove action. Index out of range.
What it means
RemoveAt throws ArgumentOutOfRangeException as a guard whenever the caller supplies an index outside the valid range [0, Count-1] of the ActionCollection. It fires before any COM call is made, so the index is the faulty input; callers like Remove use it defensively and swallow it to signal 'not found'.
Source
Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/ActionCollection.cs:580
if (idx != -1)
{
try
{
RemoveAt(idx);
return true;
}
catch { }
}
return false;
}
/// <summary>Removes the action at a specified index.</summary>
/// <param name="index">Index of action to remove.</param>
/// <exception cref="ArgumentOutOfRangeException">Index out of range.</exception>
public void RemoveAt(int index)
{
if (index < 0 || index >= Count)
throw new ArgumentOutOfRangeException(nameof(index), index, "Failed to remove action. Index out of range.");
var item = this[index].Clone();
if (v2Coll != null)
v2Coll.Remove(++index);
else
{
v1Actions.RemoveAt(index);
SaveV1Actions();
}
if (!inV2set)
{
OnNotifyPropertyChanged(nameof(Count));
OnNotifyPropertyChanged(IndexerName);
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
}
}
/// <summary>Copies the elements of the <see cref="ActionCollection"/> to a new array.</summary>
/// <returns>An array containing copies of the elements of the <see cref="ActionCollection"/>.</returns>View on GitHub (pinned to 53fb989abc)
Solutions
- Check the index against Count (e.g. if (idx >= 0 && idx < actions.Count)) before calling RemoveAt.
- Use the collection's Remove(action) method instead, which locates the action and returns false rather than throwing when it is absent.
- Wrap RemoveAt in try/catch (ArgumentOutOfRangeException) if absence is an acceptable outcome.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/ActionCollection.cs:580 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/059e1855d8de293b.
Report an issue: GitHub.