Forum Discussion

Harsha3's avatar
Harsha3
New Contributor III
5 years ago

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

8 Replies

  • Shreyas_S's avatar
    Shreyas_S
    New Contributor

    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?

    • Shreyas_S's avatar
      Shreyas_S
      New Contributor

      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

      • ptaylor's avatar
        ptaylor
        Employee

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

  • Shreyas_S's avatar
    Shreyas_S
    New Contributor

    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.

    • ptaylor's avatar
      ptaylor
      Employee

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