On a fresh Espo CRM Version 10.0 installation, the unread notification counter repeatedly returns an Internal Server Error.
Endpoint:
GET /Notification/action/notReadCount
Log:
[2026-07-04 15:06:43] CRITICAL: (0) :: GET /Notification/action/notReadCount
[object] (UnexpectedValueException(code: 0): at
/application/Espo/Tools/Notification/RecordService.php:303)
The error repeats every few seconds because the frontend retries the unread notification count request.
Environment:
- EspoCRM: v10.0.0
- PHP: 8.5.6
- MySQL: 8.0.33
- Database driver: pdo_mysql
- New/fresh installation
- No customisations or extensions installed
Cause:
In application/Espo/Tools/Notification/RecordService.php, the query result for COUNT() is returned as a numeric string by the database driver, but the code requires it to be strictly an integer:
$count = $row['c'] ?? null;
if (!is_int($count)) {
throw new UnexpectedValueException();
}
return $count;
Temporary workaround that resolved the issue:
$count = $row['c'] ?? null;
if (!is_numeric($count)) {
throw new UnexpectedValueException();
}
return (int) $count;
Expected behaviour:
The notification unread-count endpoint should accept numeric COUNT() results returned as strings by PDO/MySQL and return an integer without a server error.
Please consider casting the count result to int, or allowing numeric values before casting.
Any permanent solution or work around will be much appreciated as the above will change if any update or upgrade is carried out.
Endpoint:
GET /Notification/action/notReadCount
Log:
[2026-07-04 15:06:43] CRITICAL: (0) :: GET /Notification/action/notReadCount
[object] (UnexpectedValueException(code: 0): at
/application/Espo/Tools/Notification/RecordService.php:303)
The error repeats every few seconds because the frontend retries the unread notification count request.
Environment:
- EspoCRM: v10.0.0
- PHP: 8.5.6
- MySQL: 8.0.33
- Database driver: pdo_mysql
- New/fresh installation
- No customisations or extensions installed
Cause:
In application/Espo/Tools/Notification/RecordService.php, the query result for COUNT() is returned as a numeric string by the database driver, but the code requires it to be strictly an integer:
$count = $row['c'] ?? null;
if (!is_int($count)) {
throw new UnexpectedValueException();
}
return $count;
Temporary workaround that resolved the issue:
$count = $row['c'] ?? null;
if (!is_numeric($count)) {
throw new UnexpectedValueException();
}
return (int) $count;
Expected behaviour:
The notification unread-count endpoint should accept numeric COUNT() results returned as strings by PDO/MySQL and return an integer without a server error.
Please consider casting the count result to int, or allowing numeric values before casting.
Any permanent solution or work around will be much appreciated as the above will change if any update or upgrade is carried out.

Comment