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.

KEY_OVER_1024_CHARS error with large indented blocks of comments

See original GitHub issue

Describe the bug If there’s a large block of comments hanging indented under a key, that can trigger an error suggesting that the next key indicator is too far away.

To Reproduce

const comment = `# Test comment
owners:
  # Test comment
  business:
    - email: great.googly@fortitude.com
      name: Moogly
    - distributionList: HopsNBops@easterbunny.org

  # Another comment, large block of text, large block of text, large block of text
  # Another comment, large block of text, large block of text, large block of text
  # Another comment, large block of text, large block of text, large block of text
  # Another comment, large block of text, large block of text, large block of text
  # Another comment, large block of text, large block of text, large block of text

# Large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
stage: one
`;

console.log(yaml.parse(comment));

The script produces the error:

YAMLParseError: The : indicator must be at most 1024 chars after the start of an implicit block mapping key at line 22, column 1:

# large block of text, large block of text, large block of text, large block of…
stage: one
^^^^^

Removing the indent from the first block of comments works around the error.

Expected behaviour The text is valid YAML, it should be parsed, no matter how many comments there are or whether they’re indented.

Versions (please complete the following information):

  • Environment: Node.js 16.15.1
  • yaml: 2.1.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
eemelicommented, Oct 2, 2022

There was a bug in updating the offset during composition for empty mapping values with trailing comments. Thank you for reporting this!

Fixed version released as v2.1.2.

0reactions
eemelicommented, Oct 26, 2022

Closing as presumably fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indent comments within blocks · Issue #219 - GitHub
The reason for this is commenting-out blocks of code tends to be a temporary action, where you intend to either delete or uncomment...
Read more >
Expected an indent block in comment - Stack Overflow
I faced a weird error, "Expected an indent Block" in a comment out line - #______ICHIMOKU SYSTEM's COMPONENTS_____ center = False = see...
Read more >
IndentationError: expected an indented block - LearnDataSci
As the error implies, this occurs after statements that require indenting, such as after if statements, for loops and try except exception handling....
Read more >
Can you comment out large blocks of text without having ... - IBM
Problem. I have a series of large syntax jobs in SPSS for Windows. I'd often like to comment out large portions of those...
Read more >
comment indentation can break code indentation
The issues with incorrect comment indentation is affecting the indentation of the CODE that follows the comments, too. The attached screen show shows...
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