CalendarAgent continuous error generation in MacOS 10.12.4 After upgrading to MacOS 10.12.4 today, I started getting tons of Error/Fault log message in the Console generated by the CalendarAgent process. 
Some of the errors are pasted below: 

error: sql cached statement NSSQLiteStatement &lt;0x7fae52e27ad0&gt; on entity 'CalDAVError' with sql text 'SELECT t0.Z_ENT, t0.Z_PK, t0.Z_OPT, t0.ZCODE, t0.ZDOMAIN, t0.ZUSERINFO, t0.ZCHANGEREQUEST, t0.Z8_CHANGEREQUEST, t0.ZPRINCIPAL, t0.ZOPERATION, t0.ZPRINCIPAL1, t0.ZPUBLICATION, t0.ZSUBSCRIPTIONINFO FROM ZERROR t0 WHERE ( t0.ZPRINCIPAL IN (SELECT * FROM _Z_intarray0)  AND  t0.Z_ENT = ?) ' failed due to missing variable binding for (null) with expecting bindings (
    "&lt;NSSQLBindVariable: 0x7fae52eed410&gt;"
) but actual substitution variables {
    destinations = "{0x400072b &lt;x-coredata://F6135326-AEE3-4C69-AD55-060EF81D21A6/CalDAVPrincipal/p16&gt;}";
}

error: sql cached statement NSSQLiteStatement &lt;0x7fae551cadc0&gt; on entity 'Attachment' with sql text 'SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZATTACHMENTID, t0.ZCONTENTTYPE, t0.ZFILENAMEINCACHE, t0.ZFILENAMESUGGESTEDBYSERVER, t0.ZISAUTOARCHIVED, t0.ZISCACHED, t0.ZOMITSYNCRECORD, t0.ZPATHONDISKSTRING, t0.ZURLSTRING, t0.ZUUID, t0.ZITEM, t0.Z4_ITEM FROM ZATTACHMENT t0 WHERE  t0.ZITEM IN (SELECT * FROM _Z_intarray0)  ORDER BY t0.ZITEM' failed due to missing variable binding for (null) with expecting bindings (
) but actual substitution variables {
    destinations = "{0xd340030b &lt;x-coredata://F6135326-AEE3-4C69-AD55-060EF81D21A6/Event/p845&gt;, 0xf2c0030b &lt;x-coredata://F6135326-AEE3-4C69-AD55-060EF81D21A6/Event/p971&gt;}";
}


The number of errors generated within a few minutes is more than 6000!. What do you think the reason could be? 
If you think I need to add more details, please state in the comments.
The possible problem is that database schema or some of database entries are incompatible with latest Calendar app. Or may be these entries are corrupted.

There are 2 possible solutions:


fix db which is tricky.
drop db - it's just cached data of your cloud accounts.


to do the 2nd option:


stop Calendar App (ctrl+q), then 
open ~/Library/Calendars and
remove Calendar Cache files (you may just trash them)
start Calendar App again.


You will need probably reactivate your calendar accounts.

To do so, open calendar app settings and choose desired accounts in accounts section