Snaplogic CSV parser failing

Hi Team,

While parsing a csv I got an “EOF reached before encapsulation token finished” error . However when checked each field is mapped to the header appropriately . After this error I again ran the pipeline without touching anything and we got the proper result . So is this error intermittent if not why on running again does not cause any problem , kindly advise.

Thanks,
Harshavardhana

1 Like

I’m running into the same issue.

Hi All ,

Any update on this issue thread ? Even I am facing the same issue with the CSV File I am having.

@Harsha3 @evanhk @Shreyas.S I’m sorry no one has responded yet. Have any of you create a support ticket about this issue?

Hi @ptaylor ,

For my requirement use case , I do actually have an alternate solution for the issue from source end and have proceeded with the same . However would really like to understand the root cause for the same . We are receiving a CSV File from source system in Windows-1252 character set which we are using a Transcoder to change it to UTF-8 and then passing it to CSV Parser . Upon execution of the Snap after processing a certain no of records it is failing with the below error . As an alternate solution , we have asked the source system to change the character set as UTF-8 and push the file which is working without any issues.

Caused by: java.lang.RuntimeException: java.io.IOException: (startline 169) EOF reached before encapsulated token finished
at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:442)
at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:452)
at com.snaplogic.snaps.transform.CSVParser.doWork(CSVParser.java:325)
… 12 more
Caused by: java.io.IOException: (startline 169) EOF reached before encapsulated token finished
at org.apache.commons.csv.Lexer.parseEncapsulatedToken(Lexer.java:300)
at org.apache.commons.csv.Lexer.nextToken(Lexer.java:152)
at org.apache.commons.csv.CSVParser.nextRecord(CSVParser.java:498)
at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:439)
… 14 more
Reason: java.io.IOException: (startline 169) EOF reached before encapsulated token finished
Resolution: Please provide valid CSV data at line 168 or route it to the error view

Thanks for the details. Do you have a sample CSV file we could use to reproduce the issue?

Also, which snap are you using to read the file? File Reader? Something else? I wouldn’t think you’d need the Transcoder since the CSV Parser should be able to recognize the charset in the metadata from the upstream snap, but perhaps I’m wrong about that.

Hi @ptaylor . Yes using File Reader Snap itself . Transcoder Snap is used since previously while trying to parse the files after reading we used to get errors due to some special characters present in it . However the present file which is failing does not have such special characters. But in future the data in the file might have it so Transcoder snap would be needed.

Do you have a sample CSV file we could use to reproduce the issue?