question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bypass duplicated mapping key ?

See original GitHub issue

When loading a YAML file with a duplicate key, I got this message error.

{
    "name":"YAMLException",
    "reason":"duplicated mapping key",
    "mark":{...},
    "message":"duplicated mapping key at line 388, column 5:\n        last_published: \"Last published\"\n        ^"
}"

Is there a way to bypass this error and take the last value input, here, to have duplicate as true ?

test:
      duplicate: false
      duplicate: true

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
puzrincommented, Nov 27, 2020

@arcanis ok, create a new issue with this details please. Need to think.

0reactions
arcaniscommented, Nov 27, 2020

@puzrin By any chance, would you be open to reevaluate this? We’re using js-yaml on Yarn (our lockfiles are now regular Yaml), and to make our users’ life easier we try to gracefully recover from lockfile merge conflicts (basically we parse both current and incoming versions of the lockfile, then merge them together). It turns out that in some circumstances Git will generate a bogus lockfile that duplicates some keys.

In our case it’s not a big deal (it’s best effort recovery, and both entries contain the same data anyway), but the lack of option to signal to js-yaml that it should just ignore the problem means that we sometimes have to throw pretty annoying errors:

➤ YN0046: The individual variants of the lockfile failed to parse

When that happens, there’s no other choice for the user than remove the lockfile, and lose all their current locked resolutions. It’s not a great experience 🙁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove duplicated mapping key in config/locales/en.yml
The source project of this merge request has been removed. Remove duplicated mapping key in config/locales/en.yml.
Read more >
Hi, i have been having issues with my template. trying to track ...
Hi, i have been having issues with my template. trying to track this error. i can not find any file to fix. or...
Read more >
YAMLException: duplicated mapping key at line 112, column 1
When I run my application I am getting this error in my cmd. Attached my YAML file.
Read more >
Ords Parser error duplicated mapping key - swagger
Hi! I have posted about this error before. "Ords 21.3.1.301.2050 - swagger duplicated key" Any solution for this?
Read more >
java - Ignore duplicates when producing map using streams
The other way is to "start" with either a Hash or a Set...And carefully track through to make sure the keys never duplicate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found