CSV::MalformedCSVErro

I am trying to do a Jekyll build after I changes some files.

I am getting the following:

C:\Users\india\OneDrive\Documents\Australia\BHSQ\bhqweb.github.io\trunk>jekyll b
Configuration file: C:/Users/india/OneDrive/Documents/Australia/BHSQ/bhqweb.github.io/trunk/_config.yml
            Source: C:/Users/india/OneDrive/Documents/Australia/BHSQ/bhqweb.github.io/trunk
       Destination: C:/Users/india/OneDrive/Documents/Australia/BHSQ/bhqweb.github.io/trunk/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    ------------------------------------------------
      Jekyll 4.1.1   Please append `--trace` to the `build` command
                     for any additional information or backtrace.
                    ------------------------------------------------
Traceback (most recent call last):
        39: from C:/programs/Ruby27-x64/bin/jekyll:23:in `<main>'
        38: from C:/programs/Ruby27-x64/bin/jekyll:23:in `load'
        37: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/exe/jekyll:15:in `<top (required)>'
        36: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        35: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        34: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        33: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        32: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        31: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        30: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        29: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `each'
        28: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        27: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:36:in `process'
        26: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/commands/build.rb:65:in `build'
        25: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/command.rb:28:in `process_site'
        24: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:78:in `process'
        23: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/site.rb:180:in `read'
        22: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/reader.rb:19:in `read'
        21: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:21:in `read'
        20: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:39:in `read_data_to'
        19: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:39:in `each'
        18: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:44:in `block in read_data_to'
        17: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:39:in `read_data_to'
        16: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:39:in `each'
        15: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:47:in `block in read_data_to'
        14: from C:/programs/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/readers/data_reader.rb:62:in `read_data_file'
        13: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv.rb:715:in `read'
        12: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv.rb:658:in `open'
        11: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv.rb:715:in `block in read'
        10: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv.rb:1289:in `read'
         9: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv.rb:1289:in `to_a'
         8: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv.rb:1280:in `each'
         7: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv.rb:1280:in `each'
         6: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv/parser.rb:336:in `parse'
         5: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv/parser.rb:823:in `parse_quotable_loose'
         4: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv/parser.rb:49:in `each_line'
         3: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv/parser.rb:49:in `each_line'
         2: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv/parser.rb:52:in `block in each_line'
         1: from C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv/parser.rb:842:in `block in parse_quotable_loose'
C:/programs/Ruby27-x64/lib/ruby/2.7.0/csv/parser.rb:928:in `parse_quotable_robust': New line must be <"\\r\\n"> not <"\\n"> in line 33. (CSV::MalformedCSVError)

I have some TSV files that had the wrong ending with just LF and not CR LF. But I have fixed those. But I still get this error.

I am amazed that I am not told which file and which line is causing a problem. I am interacting with Jekyll not Ruby. The Ruby debug info is useless to me.

I had a newer Ruby setup but went backwards as that was one suggestion I read online.

Any thoughts on how I solve this?

I’d still like Jekyll to tell me what file is causing the issue. That would have saved me a ton of time.

I found the problem. Jekyll created a _site folder in the _data folder with a copy of the files that were in the _data folder. The copying was done before I fixed the TSV file in the _data folder.

Jekyll will always build those files for you, so maybe don’t use the --incremental switch unless you really have to.

I am amazed that I am not told which file and which line is causing a problem. I am interacting with Jekyll not Ruby. The Ruby debug info is useless to me.

I am having the same problem. Could someone explain what’s really going on here? I assume that Jekyll imports CSV data on a file-by-file basis, so it should be able to report which CSV file is malformed.

Do you have a public repo for this that you can share so we can take a look?

Since you had this issue before and fixed it, is it possible you missed something? From [unfortunate] real-life experience, I know working with CSV and TSV files can be tedious and prone to error. You might want to open the files in an app like VS Code and use an extension like Render Line Endings to verify there aren’t end-of-line (EOL) inconsistencies.