The error "Invalid byte sequence for encoding "UTF-8": 0x00" occurs at the "Save an alerting event data batch" step in an AGP flow


When running the SAS® Visual Investigator Alerts Generation Process (AGP) flow run, the flow fails at the "Saving an alerting event batch" step with the Invalid byte sequence for encoding "UTF-8": 0x00 error.

In addition, the following errors occur in the svi-alerts logs:

2024-08-18 17:12:42.554  INFO 26009 — [TaskExecutor-28] c.s.f.t.s.A.Performance                  : sas.svi-alert@@fccprod [afe5cb4d9d1680db] BEGIN processing of alerting events. Number of events received: 121
2024-08-18 17:12:43.790  INFO 26009 — [TaskExecutor-28] c.s.f.t.s.a.T.Performance                : sas.svi-alert@@fccprod [afe5cb4d9d1680db] Call to com.sas.fcs.tdc.services.DataHubService.getDocumentLabels returned 121 records in 1229ms
2024-08-18 17:12:44.255  WARN 26009 — [TaskExecutor-28] o.h.engine.jdbc.spi.SqlExceptionHelper   : sas.svi-alert@@fccprod [afe5cb4d9d1680db] SQL Error: 0, SQLState: 22021
2024-08-18 17:12:44.255 ERROR 26009 — [TaskExecutor-28] o.h.engine.jdbc.spi.SqlExceptionHelper   : sas.svi-alert@@fccprod [afe5cb4d9d1680db] ERROR: invalid byte sequence for encoding "UTF8": 0x00
2024-08-18 17:12:44.256 ERROR 26009 — [TaskExecutor-28] c.s.f.tdc.services.AlertingEventService  : sas.svi-alert@@fccprod [afe5cb4d9d1680db] Alerting data processing fatal exception
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
Caused by: org.hibernate.exception.DataException: could not execute statement
Caused by: org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
2024-08-18 17:12:44.258  INFO 26009 — [TaskExecutor-28] c.s.f.t.m.MessageQueue.Performance       : anonymousUser@@fccprod [afe5cb4d9d1680db] EXIT receiveEvent: 2a3e2e46-7b67-4a6a-b8d5-6ed0523ca492 Duration: 00:00:01.721

This is an alerting event sent from the Visual Scenario Designer (VSD) service. The alerting event includes a scenario-fired event that contains a contributing object. Here is an example:

{
    "version": 1,
    "contributingObjectType": "TM_TRANSACTIONS",
    "contributingObjectId": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
    "workspaceFlag": false,
    "triggeringFlag": true
}, 

Workaround

To circumvent this issue, replace the last non-empty record metric with the minimum or maximum functionality in the aggregation scenarios.