peass-ng/PEASS-ng · error · ArgumentException

Same key already exists.

Error message

Same key already exists.

What it means

A duplicate-key guard in the internal hash-map Add of TypeUtils: before inserting the new KeyValue the code checks hashes.ContainsKey(key) and rejects the Add because the key is already present — the standard dictionary duplicate-insert contract.

Source

Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/YamlSerializer/TypeUtils.cs:312

            class KeyValue
            {
                public int hash;
                public K key;
                public V value;
                public KeyValue(K key, V value)
                {
                    this.key = key;
                    this.value = value;
                    this.hash = key.GetHashCode();
                }
            }

            #region IDictionary<K,V> メンバ

            public void Add(K key, V value)
            {
                if ( hashes.ContainsKey(key) )
                    throw new ArgumentException("Same key already exists.");
                var entry = new KeyValue(key, value);
                object item;
                if ( items.TryGetValue(entry.hash, out item) ) {

                } else {
                }
            }

            public bool ContainsKey(K key)
            {
                throw new NotImplementedException();
            }

            public ICollection<K> Keys
            {
                get { throw new NotImplementedException(); }
            }

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Use ContainsKey or TryGetValue before Add to decide insert vs update
  2. Use an overwrite semantics (indexer) where duplicates should replace
  3. Ensure keys are unique by construction before populating the map
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/YamlSerializer/TypeUtils.cs:312 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/10c0e074401b71ce. Report an issue: GitHub.