Mapping key limit gives confusing error message.
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 597
- Forks
- 223
- Avg merge
- 11h 23m
- Merged PRs (30d)
- 3
Description
Apparently keys over 1022 characters are not supported:
> key = 'n' * 3
=> "nnn"
> text = "\"#{key}\": 12"
=> "\"nnn\": 12"
> YAML.load(text)
=> {"nnn"=>12}
> key = 'n' * 1023
=> "nnnnnnn..."
> text = "\"#{key}\": 12"
=> "\"nnnnnn..."
> YAML.load(text)
Traceback (most recent call last):
6: from /usr/local/rvm/rubies/ruby-2.5.3/bin/irb:11:in `<main>'
5: from (irb):53
4: from /usr/local/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/psych.rb:263:in `load'
3: from /usr/local/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/psych.rb:350:in `parse'
2: from /usr/local/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/psych.rb:402:in `parse_stream'
1: from /usr/local/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/psych.rb:402:in `parse'
Psych::SyntaxError ((<unknown>): mapping values are not allowed in this context at line 1 column 1026)
the "mapping values are not allowed" is not a clear error message for this situation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the YAML.load example from the issue and trace the Psych.load/parse path shown in lib/psych.rb at lines 263, 350, and 402. Identify where this parser failure can receive a clearer message, then add coverage for a mapping key over 1022 characters and verify the resulting error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100