Error: Could not purge old metrics:database disk image is malformed

I have a Gateway Event Script set up to run on a timer. The script runs fine when executed as the click event of a button but gives this error in the MetricHistoryManager logger running as a Gateway Event Script: Could not purge old metrics:database disk image is malformed. I have no idea what that means, can anyone help?

I’m not a DB guru, but after searching Google, I would suggest the following:

First, post your script so others can see what code is causing the error.

The top Google results seemed to be for SQLLite or products using it, so:

Do you have a SQLLite connection? Could that be causing problems for you? If not, and if all your DB connections are working then then my guess is that the problem could be with the internal Ignition DB.

If you can rule out external DB errors, and get to the internal DB, then I would take a gateway backup, and uninstall and reinstall Ignition. See if that clears the problem. (Also you might wait to see if someone responds once you put your code up here before doing the re-installation.)


I do not think that this error is related. The metric history manager is the system in 7.9 that tracks gateway performance. It does this in a separate SQLite database, which is the one that the error message is complaining about.

As for the scoping issue, it may be the case that there is a tag path somewhere in the script that does not include the tag provider, so it is able to assume the default provider when run in client scope, but it does not know what to do with it in gateway scope.

If that is not the case, then it would help to post the script, as Caleb suggested.

I just check on Ignition Gateway from one of our clients and seen log full of this error:

What is this about and how can we ‘fight’ this?

I just deleted the metricsdb.idb file inside Ignition data/metricsdb folder (in Windows), restart the gateway and no more errors…