siyuan-note/siyuan · error
incompatible encrypted index
Error message
incompatible encrypted index
What it means
The stored compatibility metadata does not match what the current kernel expects: the index kind, schema version, or recorded cipher settings differ from the values computed for this open. This is a deliberate authentication gate — the index was built with a different schema or cipher configuration and must not be read until rebuilt from authenticated source documents.
Solutions
- Rebuild the index from the authenticated source documents (the caller owns reindexing)
- Upgrade or downgrade the kernel so kind/schema/cipher settings match the metadata
- Restore the workspace from a sync snapshot taken with a matching kernel version
- Do not edit encrypted_index_meta rows manually — the cipher settings must genuinely match
Defensive patterns
Strategy: fallback
Validate before calling
// compare stored metadata with current expectations before opening
var kind, settings string; var schema int
db.QueryRow("SELECT kind, schema_version, cipher_settings FROM encrypted_index_meta").Scan(&kind, &schema, &settings) Try / catch
if strings.Contains(err.Error(), "incompatible encrypted index") {
// trigger authenticated reindex of the affected documents
} Prevention
- Keep all machines in a sync group on the same kernel version
- Do not change cipher parameters (page size, KDF iterations) on existing notebooks
- Read release notes for schema bumps; rebuild indexes as instructed
- Never hand-edit encrypted_index_meta to force a match
When it happens
Trigger: Opening an index whose schema_version or kind differs from the value passed by OpenEncryptedDB/OpenEncryptedBlockTreeDB, or whose recorded cipher PRAGMAs (kdf_iter, cipher_page_size, etc.) differ from the current settings — typically after a kernel upgrade that bumped the schema or a cipher parameter change.
Common situations: Downgrading the kernel after a schema bump; switching encryption settings (page size, KDF iterations); opening an index belonging to a different subsystem (wrong kind); a workspace synced between machines running different kernel versions.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- encrypted index has no compatibility metadata
- Conf.Language(381)
- database history contains an invalid field
- each key must be an object
- encrypted blocktree db not opened for box
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/3ec58dd5f21cec54.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/util/encrypted_index.go:62
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
}
if storedKind != kind || storedSchema != schema || storedSettings != string(encoded) {
return errors.New("incompatible encrypted index")
}
return nil
}
View on GitHub (pinned to 9f775e8a12)