If you encounter the “database image malformed” error in wazuh-db, it usually means that one or more of Wazuh’s internal SQLite databases have become corrupted.
Because wazuh-db is responsible for storing and retrieving critical endpoint information, corruption can quickly affect multiple components across your Wazuh deployment.
Depending on which database is damaged, the symptoms can range from relatively minor inconsistencies to widespread monitoring failures.
Administrators may notice that agents stop updating their inventory, File Integrity Monitoring (FIM) results disappear, vulnerability detection stops producing findings, or the Wazuh manager fails to process certain events correctly.
In severe cases, agents remain connected but their metadata no longer updates, making it difficult to trust the information displayed in the Wazuh Dashboard.
The error itself originates from SQLite, the embedded database engine used by wazuh-db. SQLite reports “database disk image is malformed” whenever it detects structural corruption that prevents it from reading database pages safely.
Rather than continuing to operate on a damaged database and risking additional data loss, Wazuh surfaces the error so administrators can investigate and repair or rebuild the affected database.
Database corruption can occur for several reasons, including unexpected power failures, disk errors, abrupt system shutdowns, filesystem corruption, storage hardware failures, or processes being terminated while SQLite is writing changes to disk.
In this guide, you’ll learn how wazuh-db database image malformed errors occur, how to identify the affected database, how to verify whether corruption actually exists, and the safest recovery procedures.
We’ll also cover preventive best practices that reduce the likelihood of future database corruption and help keep your Wazuh deployment healthy.
Resource:
SQLite Database Corruption Documentation – https://www.sqlite.org/howtocorrupt.html
What Is wazuh-db?
The wazuh-db daemon is one of the core services within the Wazuh manager.
It acts as a high-performance database interface between other Wazuh components and the SQLite databases that store agent-related information.
Instead of every module interacting directly with SQLite files, modules communicate with wazuh-db, which manages database access, synchronization, and consistency.
This architecture improves performance while reducing contention between multiple Wazuh processes that need simultaneous access to agent data.
At its core, wazuh-db uses SQLite because it is lightweight, reliable, serverless, and well suited for local database operations.
Each agent maintains its own database containing operational information that various Wazuh modules continuously update.
How wazuh-db stores
These databases commonly store:
- Agent metadata and registration information
- File Integrity Monitoring (FIM) events and file state
- Syscollector hardware and software inventory
- Vulnerability Detection package information
- Agent synchronization and state tracking data
- Internal module metadata used by multiple Wazuh services
For example:
- Syscollector continuously updates installed software, operating system information, running processes, network interfaces, and hardware inventory.
- Vulnerability Detection compares collected package information against vulnerability feeds.
- File Integrity Monitoring records monitored files and detects changes over time.
- Other modules rely on the same databases to maintain agent state and synchronization.
Because so many Wazuh components depend on these SQLite databases, maintaining database integrity is essential.
Even a single corrupted database page can prevent modules from reading inventory data or writing new information, leading to cascading issues throughout the Wazuh platform.
Healthy databases allow:
- Reliable event processing
- Accurate asset inventories
- Consistent vulnerability scanning
- Stable File Integrity Monitoring
- Proper synchronization between agents and the manager
Once corruption appears, administrators should treat it as a storage integrity issue rather than simply restarting services, since restarting alone rarely repairs damaged SQLite files.
Resources:
Wazuh Architecture Documentation – https://documentation.wazuh.com/current/getting-started/architecture.html
Related Guides:
- How to Build a Wazuh Indexer Cluster
- Wazuh Vulnerability Detection Not Working? Here’s How to Fix It
- How to Configure File Integrity Monitoring (FIM) in Wazuh
What Does “database image malformed” Mean?
The error “database image malformed” is generated directly by SQLite when it detects corruption within the physical structure of a database file.
Rather than indicating an application bug in Wazuh itself, the message tells you that SQLite can no longer safely interpret part of the database.
Unlike traditional database servers, SQLite stores the entire database in a single file.
Every table, index, page, and metadata structure must remain internally consistent.
If SQLite discovers invalid page headers, broken indexes, corrupted B-tree structures, missing pages, or inconsistent checksums, it reports the database as malformed.
When wazuh-db attempts to query or update a corrupted database, SQLite returns an error similar to:
database disk image is malformedWazuh then records the failure in its logs because the requested operation cannot be completed successfully.
Difference between logical corruption and filesystem corruption
It is important to distinguish between logical database corruption and filesystem corruption.
Logical database corruption occurs when the SQLite file itself contains damaged structures.
This may result from interrupted writes, hardware failures, memory corruption, or software crashes during database updates.
Filesystem corruption, on the other hand, affects the storage layer beneath SQLite.
Problems such as bad sectors, damaged filesystems, failing SSDs, RAID issues, or kernel storage errors may corrupt multiple files, not just the SQLite database.
In these situations, simply rebuilding the database without addressing the underlying storage issue often results in recurring corruption.
Administrators frequently discover the problem while reviewing Wazuh manager logs.
Common log messages include:
wazuh-db: ERROR: database disk image is malformed
wazuh-db: ERROR: SQLite database query failed.
wazuh-db: ERROR: Cannot execute statement because the database is corrupted.
ossec-analysisd: WARNING: Failed to retrieve agent database information.
wazuh-modulesd: ERROR: Unable to update Syscollector inventory.The exact messages vary depending on which Wazuh module is accessing the damaged database, but they generally point back to SQLite reporting corruption.
Whenever you see this error, avoid immediately deleting the database.
First determine whether the corruption is isolated to a single agent database or indicative of broader storage problems.
Checking filesystem health, disk SMART data, and system logs before rebuilding the database can prevent repeated failures caused by an underlying hardware issue.
Feature insight: The SQLite developers emphasize that SQLite database corruption is uncommon under normal operation and is most often associated with external factors such as faulty storage hardware, filesystem issues, incomplete writes caused by power loss, or application-level misuse.
Their guidance recommends identifying and eliminating the root cause before restoring or recreating the database to avoid repeated corruption.
Example log snippet
2026/07/09 11:14:08 wazuh-db: ERROR: database disk image is malformed
2026/07/09 11:14:08 wazuh-db: ERROR: Cannot execute SQL statement.
2026/07/09 11:14:08 wazuh-modulesd:syscollector: ERROR: Failed to update agent inventory.
2026/07/09 11:14:09 wazuh-db: INFO: Retrying database operation.
2026/07/09 11:14:09 wazuh-db: ERROR: database disk image is malformedSQLite “How To Corrupt Your Database Files” – https://www.sqlite.org/howtocorrupt.html

Be First to Comment