Support Article

Invalid escape sequence - Service File rule



When using a service file to load and create collection cases, the user has a comma-separated csv file where each cell value entered in double quotes. If the cell value enters double quotes the file will not process.

Error Messages Error while parsing: Invalid escape sequence. Escape character must be followed by either field delimiter, or record delimiter, or another escape character
From: (
at com.pega.pegarules.integration.engine.internal.mapping.DelimitedParserBase.parse(
at com.pega.pegarules.integration.engine.internal.util.PRServiceUtils.executeServiceSimulation(
at com.pegarules.generated.activity.ra_action_execute_826676c154eb827ac6dc2d43a411dc1b.step7_circum0(
at com.pegarules.generated.activity.ra_action_execute_826676c154eb827ac6dc2d43a411dc1b.perform(
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(
at com.pegarules.generated.activity.ra_action_runruleexecute_10dce25211d8bbd6fd3f9cba17fc8a7c.step12_circum0(
at com.pegarules.generated.activity.ra_action_runruleexecute_10dce25211d8bbd6fd3f9cba17fc8a7c.perform(
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(
at com.pega.pegarules.session.internal.mgmt.PRThreadImpl.runActivitiesAlt(
at com.pega.pegarules.session.internal.engineinterface.service.HttpAPI.runActivities(
at com.pega.pegarules.session.external.engineinterface.service.EngineAPI.processRequestInner(
at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)

Steps to Reproduce

  1. Create Service File rule
  2. Method tab set record terminator to \n
  3. Delimited Parserule, define comma separated csv file
  4. CSV file enter 2 or more rows where each cell specified in quotes.

For example:
"value 1", "value 2", "value 3"

Root Cause

This is an expected behaviour as per product design for the case of CSV file. Since the user expects the double quotes to remain, a better approach is to define Custom Delimiter and Escape Character.


Perform the following local-change:

Using the Field format “Custom Definition” gives us the privilege choose Delimiter and Escape Character of our choice.

Since, in this use case we are listening to a CSV file, the following configuration in File Listener should suffice:

Published April 20, 2017 - Updated April 27, 2017

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.