Duplicate Keys Cause Issues

Issue #386 resolved
Nathan Wolf
created an issue

I have recently updated from 1.17 to 1.18 and I'm finding some strange behavior now with Yaml files that have duplicate top-level keys.

I will attempt to put together a reproduction case with test data, but I believe the problem is somewhere in this method:


I am using default LoadingConfig options, so duplicate keys should be allowed.

The strange thing is that if duplicate keys exist at the top level, other (non-duplicate) keys at the top level get removed. I am missing entire sections in certain configs. Cleaning them up by removing the duplicate keys fixes the problem, but I have users that may not know to do that, and their previously-working files may break in very unexpected ways when they update.

I will do my best to come back with an example, I realize this is a vague bug report without but I was hoping to get the ball rolling.

Thank you for your time!

Comments (6)

  1. Nathan Wolf reporter

    Here is as simple a test case as I was able to make: Duplicate key parser

    This project contains a yaml file with several duplicate keys. When I tried to cut down on the number of keys much more, the error stopped occurring.

    • Expected behavior: Parsing this file returns all of the sections contained in the file, except for duplicates.
    • Actual behavior: One non-duplicated section is not missing.

    Test output:

    Reading duplicates.yml
     Found duplicate key: amplify
     Found duplicate key: recall
     Found duplicate key: recantoenchantum|2
     Found duplicate key: vulnera
    Loaded 146 Yaml nodes and parsed 147 unique keys.
    *** Expected key 'gather' not found in loaded map.

    The example yaml file that causes this behavior can be seen here.

  2. Log in to comment