Error running core:archive

I have a Matomo instance running for a few days. The web UI is working fine. I’m trying to setup an archive cron job. Each time I run I get the following error. Any suggestions on how to track down the issue? I’m running Matomo 3.5.0 on Ubuntu with php 7.0.30

INFO [2018-08-22 18:00:05] 2398  - Reports for today will be processed at most every 150 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO [2018-08-22 18:00:05] 2398  - Reports for the current week/month/year will be requested at most every 3600 seconds.
INFO [2018-08-22 18:00:05] 2398  - Will process 1 other websites because some old data reports have been invalidated (eg. using the Log Import script or the InvalidateReports plugin) , IDs: 1
INFO [2018-08-22 18:00:05] 2398  ---------------------------
INFO [2018-08-22 18:00:05] 2398  START
INFO [2018-08-22 18:00:05] 2398  Starting Matomo reports archiving...
INFO [2018-08-22 18:00:05] 2398  Old report was invalidated for website id 1
INFO [2018-08-22 18:00:05] 2398  Will pre-process for website id = 1, period = day, date = last52
INFO [2018-08-22 18:00:05] 2398  - pre-processing all visits
INFO [2018-08-22 18:00:32] 2398  Done archiving!
INFO [2018-08-22 18:00:32] 2398  ---------------------------
INFO [2018-08-22 18:00:32] 2398  SUMMARY
INFO [2018-08-22 18:00:32] 2398  Total visits for today across archived websites: 0
INFO [2018-08-22 18:00:32] 2398  Archived today's reports for 0 websites
INFO [2018-08-22 18:00:32] 2398  Archived week/month/year for 0 websites
INFO [2018-08-22 18:00:32] 2398  Skipped 1 websites
INFO [2018-08-22 18:00:32] 2398  - 0 skipped because no new visit since the last script execution
INFO [2018-08-22 18:00:32] 2398  - 0 skipped because existing daily reports are less than 150 seconds old
INFO [2018-08-22 18:00:32] 2398  - 0 skipped because existing week/month/year periods reports are less than 3600 seconds old
INFO [2018-08-22 18:00:32] 2398  - 1 skipped because got an error while querying reporting API
INFO [2018-08-22 18:00:32] 2398  Total API requests: 0
INFO [2018-08-22 18:00:32] 2398  done: 0/1 0%, 0 vtoday, 0 wtoday, 0 wperiods, 0 req, 26373 ms, 1 errors.
INFO [2018-08-22 18:00:32] 2398  Time elapsed: 26.373s
INFO [2018-08-22 18:00:32] 2398  ---------------------------
INFO [2018-08-22 18:00:32] 2398  SCHEDULED TASKS
INFO [2018-08-22 18:00:32] 2398  Starting Scheduled tasks...
INFO [2018-08-22 18:00:32] 2398  Scheduler: executing task Piwik\Plugins\ExamplePlugin\Tasks.myTask...
INFO [2018-08-22 18:00:32] 2398  Scheduler: finished. Time elapsed: 0.000s
INFO [2018-08-22 18:00:32] 2398  Scheduler: executing task Piwik\Plugins\CustomPiwikJs\Tasks.updateTracker...
INFO [2018-08-22 18:00:32] 2398  Scheduler: finished. Time elapsed: 0.001s
INFO [2018-08-22 18:00:32] 2398  Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.anonymizePastData...
INFO [2018-08-22 18:00:32] 2398  Scheduler: finished. Time elapsed: 0.001s
INFO [2018-08-22 18:00:32] 2398  done
INFO [2018-08-22 18:00:32] 2398  ---------------------------
INFO [2018-08-22 18:00:32] 2398  ---------------------------
INFO [2018-08-22 18:00:32] 2398  SUMMARY OF ERRORS
INFO [2018-08-22 18:00:32] 2398  Error: Empty or invalid response INFO [2018-08-22 18:19:34] piwik.DEBUG: Loaded plugins:
 CorePluginsAdmin, CoreAdminHome, CoreHome, WebsiteMeasurable, Diagnostics, CoreVisualizations,
 Proxy, API, ExamplePlugin, Widgetize, Transitions, LanguagesManager, Actions, Dashboard,
 MultiSites, Referrers, UserLanguage, DevicesDetection, Goals, Ecommerce, SEO, Events, 
 UserCountry, GeoIp2, VisitsSummary, VisitFrequency, VisitTime, VisitorInterest, ExampleAPI, 
 RssWidget, Feedback, Monolog, Login, UsersManager, SitesManager, Installation, CoreUpdater, 
 CoreConsole, ScheduledReports, UserCountryMap, Live, CustomVariables, PrivacyManager, 
 ImageGraph, Annotations, MobileMessaging, Overlay, SegmentEditor, Insights, Morpheus, 
 Contents, BulkTracking, Resolution, DevicePlugins, Heartbeat, Intl, Marketplace, 
 ProfessionalServices, UserId, CustomPiwikJs [] {"class":"Piwik\\Plugin\\Manager","request_id":6046}

[2018-08-22 18:19:34] piwik.DEBUG: /* trigger = CronArchive */ SELECT count(distinct log_visit.idvisitor) 
 AS `1`, count(*) AS `2`, sum(log_visit.visit_total_actions) AS `3`, max(log_visit.visit_total_actions) 
 AS `4`, sum(log_visit.visit_total_time) AS `5`, sum(case log_visit.visit_total_actions when 1 then 1 
 when 0 then 1 else 0 end) AS `6`, sum(case log_visit.visit_goal_converted when 1 then 1 else 0 end) 
 AS `7`, count(distinct log_visit.user_id) AS `39` FROM matomo_log_visit AS log_visit WHERE 
 log_visit.visit_last_action_time >= ? AND log_visit.visit_last_action_time <= ? 
 AND log_visit.idsite IN (?) [] {"class":"VisitsSummary","request_id":6046} 

[2018-08-22 18:19:34] piwik.DEBUG: PluginsArchiver::callAggregateAllPlugins: Initializing 
 archiving process for all plugins [visits = 22691, visits converted = 0] 
 ["callAggregateAllPlugins","22691","0"] {"class":"VisitsSummary","request_id":6046}

[2018-08-22 18:19:34] piwik.DEBUG: PluginsArchiver::callAggregateAllPlugins: Archiving day
 reports for plugin 'ExamplePlugin'. ["callAggregateAllPlugins","ExamplePlugin"] 
 {"class":"VisitsSummary","request_id":6046}

[2018-08-22 18:19:34] piwik.DEBUG: PluginsArchiver::callAggregateAllPlugins: Memory delta: 0 M 
 while archiving day reports for plugin 'ExamplePlugin' (for segment = ''). ["callAggregateAllPlugins",
 "Memory delta: 0 M","day","ExamplePlugin","(for segment = '')"] {"class":"VisitsSummary","request_id":6046}
 
[2018-08-22 18:19:34] piwik.DEBUG: PluginsArchiver::callAggregateAllPlugins: Archiving day 
 reports for plugin 'Actions'. ["callAggregateAllPlugins","Actions"] 
 {"class":"VisitsSummary","request_id":6046}
 
[2018-08-22 18:19:34] piwik.DEBUG: /* trigger = CronArchive */ SELECT log_action.name, log_action.type,
 log_action.idaction, log_action.url_prefix, count(distinct log_link_visit_action.idvisit) as `2`, 
 count(distinct log_link_visit_action.idvisitor) as `1`, count(*) as `12`, 
 sum( case when custom_float is null then 0 else custom_float end ) / 1000 as `30`, 
 sum( case when custom_float is null then 0 else 1 end ) as `31`, min(custom_float) / 1000 as `32`, 
 max(custom_float) / 1000 as `33`, CASE WHEN (MAX(log_link_visit_action.custom_var_v5) = 0 
 AND log_link_visit_action.custom_var_k5 = '_pk_scount') THEN 1 ELSE 0 END AS `28`, 
 SUM( CASE WHEN log_action_name_ref.type = 8 THEN 1 ELSE 0 END) AS `29` 
 FROM matomo_log_link_visit_action AS log_link_visit_action LEFT JOIN matomo_log_action 
 AS log_action ON log_link_visit_action.%s = log_action.idaction LEFT JOIN matomo_log_action 
 AS log_action_name_ref ON log_link_visit_action.idaction_name_ref = log_action_name_ref.idaction 
 WHERE log_link_visit_action.server_time >= ? AND log_link_visit_action.server_time <= ? 
 AND log_link_visit_action.idsite = ? AND log_link_visit_action.%s IS NOT NULL 
 AND log_link_visit_action.idaction_event_category IS NULL GROUP BY log_action.idaction 
 ORDER BY `12` DESC, name ASC [] {"class":"Actions","request_id":6046} 

[2018-08-22 18:19:37] piwik.DEBUG: /* trigger = CronArchive */ SELECT log_action.name, 
 log_action.type, log_action.idaction, log_action.url_prefix, 
 count(distinct log_link_visit_action.idvisit) as `2`, 
 count(distinct log_link_visit_action.idvisitor) as `1`, 
 count(*) as `12`, sum( case when custom_float is null then 0 else custom_float end ) / 1000 as `30`, 
 sum( case when custom_float is null then 0 else 1 end ) as `31`, min(custom_float) / 1000 as `32`, 
 max(custom_float) / 1000 as `33`, CASE WHEN (MAX(log_link_visit_action.custom_var_v5) = 0 
 AND log_link_visit_action.custom_var_k5 = '_pk_scount') THEN 1 ELSE 0 END AS `28`, 
 SUM( CASE WHEN log_action_name_ref.type = 8 THEN 1 ELSE 0 END) AS `29` FROM matomo_log_link_visit_action 
 AS log_link_visit_action LEFT JOIN matomo_log_action AS log_action ON log_link_visit_action.%s = log_action.idaction 
 LEFT JOIN matomo_log_action AS log_action_name_ref ON 
 log_link_visit_action.idaction_name_ref = log_action_name_ref.idaction 
 WHERE log_link_visit_action.server_time >= ? AND log_link_visit_action.server_time <= ? 
 AND log_link_visit_action.idsite = ? AND log_link_visit_action.%s IS NOT NULL AND log_link_visit_action.id

Can you fix the display of all that junk in the last line? There seems to be the needed information.

The output from core:archive ended with that single 6k char line. I manually split the last line from console output and also removed duplicate spaces so it is somewhat readable.