siyuan-note/siyuan · error
encrypted index has no compatibility metadata
Error message
encrypted index has no compatibility metadata
What it means
CheckEncryptedIndexCompatibility expects an encrypted_index_meta table holding compatibility metadata (kind, schema_version, cipher settings). If the table is absent but the database already contains other tables, the kernel refuses to proceed: an index with data but no compatibility record cannot be authenticated. A brand-new empty database gets the meta table created and seeded instead.
Solutions
- Let the kernel rebuild the index from authenticated source documents (delete the index file and reindex)
- Restore the database from a sync snapshot or file history
- Never copy plain SQLite index files into an encrypted workspace; let the kernel create encrypted indexes itself
- If this appears after a version change, follow the release's migration steps
Defensive patterns
Strategy: fallback
Validate before calling
var n int
if err := db.QueryRow("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='encrypted_index_meta'").Scan(&n); err == nil && n == 0 {
// metadata absent: schedule rebuild from authenticated source documents
} Prevention
- Do not drop or edit encrypted_index_meta manually
- Follow documented migration steps when upgrading kernels
- Never place plain SQLite indexes into encrypted workspaces
When it happens
Trigger: Opening an encrypted index DB that has data tables but no encrypted_index_meta — e.g. the meta table was dropped manually, the DB was created by a pre-metadata kernel version, or a plain unencrypted index is opened via the encrypted path.
Common situations: Upgrading from a development build before metadata was introduced; manual tampering with siyuan.db/blocktree.db; copying a plain SQLite index into an encrypted workspace.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- incompatible encrypted index
- invalid encrypted index compatibility metadata
- Conf.Language(381)
- database history contains an invalid field
- each key must be an object
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/2aa374f20bf3e494.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/util/encrypted_index.go:42
return fmt.Errorf("missing encrypted index setting %s", name)
}
settings[name] = value
}
encoded, err := json.Marshal(settings)
if err != nil {
return err
}
var metadataTables int
if err = db.QueryRow("SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'encrypted_index_meta'").Scan(&metadataTables); err != nil {
return err
}
if metadataTables == 0 {
var tables int
if err = db.QueryRow("SELECT count(*) FROM sqlite_master WHERE type = 'table'").Scan(&tables); err != nil {
return err
}
if tables != 0 {
return errors.New("encrypted index has no compatibility metadata")
}
if _, err = db.Exec("CREATE TABLE encrypted_index_meta (kind TEXT NOT NULL, schema_version INTEGER NOT NULL, cipher_settings TEXT NOT NULL)"); err != nil {
return err
}
_, err = db.Exec("INSERT INTO encrypted_index_meta VALUES (?, ?, ?)", kind, schema, string(encoded))
return err
}
var storedKind, storedSettings string
var storedSchema, rows int
if err = db.QueryRow("SELECT count(*) FROM encrypted_index_meta").Scan(&rows); err != nil {
return err
}
if rows != 1 {
return errors.New("invalid encrypted index compatibility metadata")
}
if err = db.QueryRow("SELECT kind, schema_version, cipher_settings FROM encrypted_index_meta").Scan(&storedKind, &storedSchema, &storedSettings); err != nil {
return err
}View on GitHub (pinned to 9f775e8a12)