Using YAML I/O to read in a file produces "error: not a sequence" How to fix?

Dear LLVM engineers,

My name is Konstantin Rebrov. I am trying to recreate a simple program using YAML I/O to read *.yaml files into in-memory data structures, and write those same data structures back out into a *.yaml file.

I am following the official documentation/tutorial

https://llvm.org/docs/YamlIO.html

After compilation, my simple program successfully wrote the data structures into the output.yaml file. Then I tried to make input work, using that same output.yaml file as the input.yaml file.

Unfortunately my program failed to parse the YAML file correctly, reporting such an error:

input_file2.yaml:1:1: error: not a sequence