Skip to content

--uncomment fails in a block if commented fields come before uncommented fields #178

@damemi

Description

@damemi

Hi, I'm not sure if this has been addressed before or I'm using the tool wrong. But I just found this trying it on our chart which I think might be a bug.

In a block, if commented out fields come before uncommented fields, and --uncomment is passed, I get this error parsing my values.yaml:

ERRO[2026-02-05T14:08:10-05:00] Found 1 errors while processing the chart foo (Chart.yaml) 
ERRO[2026-02-05T14:08:10-05:00] yaml: line 4: did not find expected key      
ERRO[2026-02-05T14:08:10-05:00] Execution error: some errors were found

For example,

# @schema
# description: |-
#   This is a test schema.
# @schema
myobject:
  # @schema
  # description: |-
  #   This is a test commented field.
  # @schema
  #baz: qux

  # @schema
  # description: |-
  #   This is a test field.
  # @schema
  foo: bar

but this works:

# @schema
# description: |-
#   This is a test schema.
# @schema
myobject:
  # @schema
  # description: |-
  #   This is a test field.
  # @schema
  foo: bar

  # @schema
  # description: |-
  #   This is a test commented field.
  # @schema
  #baz: qux

I haven't dug into the code, but to try to point to the issue here's what an AI agent suggested (grain of salt I know):

When inCode = true (parsing a block of commented YAML), and it encounters an uncommented line, that line gets added to the buffer instead of the result. The buffer is only flushed on empty lines.

Any help or suggestions would be welcome thanks for making this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions