#16031·LibreChat

[Bug]: Index build fails on every startup - $exists: false is not valid in a partialFilterExpression (meili_excluded_legacy_cleanup_v3)

Author: SwDevOp72Created Sep 16, 2026Updated Sep 16, 2026
Labels🐛 bug

What happened?

The partial index meili_excluded_legacy_cleanup_v3 fails to build on every startup, for both Message and Conversation, because its partialFilterExpression uses $exists: false. MongoDB rewrites this to $not, which is not among the operators allowed in a partial index, and says so explicitly in the error.

packages/data-schemas/src/models/plugins/mongoMeili.ts (line 998):

javascript
partialFilterExpression: {
  [options.excludeFromIndexPath]: { $exists: true },
  _meiliIndex: { $eq: false },
  _meiliCleanupVersion: { $exists: false },   // <- rejected by MongoDB
},

The two sibling _v3 indexes defined in the same block use $exists: true and build without error, which isolates the problem to this single expression.

Effect is limited: the index serves the cleanup of stale Meilisearch exclusions, and the query runs without it. But the build fails on every start, and the index never exists.

The index was introduced in d0f9d5625 (#15055, 2026-08-21), one day after 9c9696de8 (#15041) added a predecessor named meili_excluded_cleanup without a version suffix. There is no _v1 or _v2 in the history, and meiliCleanupVersion is 1 (mongoMeili.ts:117), so the _v3 suffix does not appear to correspond to a data migration.

A working equivalent would express the same condition without $not, for example by comparing against the current cleanup version instead of testing for absence of the field.

Version Information

LibreChat v0.8.8-rc3 (1df44848) MongoDB 8.3.7 Node.js v24.16.0 Native install on Windows Server (no Docker)

Steps to Reproduce

  1. Start LibreChat with SEARCH=true and a reachable Meilisearch instance
  2. Watch the startup log

The build fails on every start. No special data or state is needed.

What browsers are you seeing the problem on?

No response

Relevant log output

bash
error: Index build failed for "Message": Error in specification { name: "meili_excluded_legacy_cleanup_v3", partialFilterExpression: { subagentTask: { $exists: true }, _meiliIndex: { $eq: false }, _meiliCleanupVersion: { $exists: false } }, background: true, key: { _meiliIndex: 1, _meiliCleanupVersion: 1, messageId: 1 }, v: 2 } :: caused by :: Expression not supported in partial index: $not
    _meiliCleanupVersion exists

error: Index build failed for "Conversation": Error in specification { name: "meili_excluded_legacy_cleanup_v3", partialFilterExpression: { subagentThread: { $exists: true }, _meiliIndex: { $eq: false }, _meiliCleanupVersion: { $exists: false } }, background: true, key: { _meiliIndex: 1, _meiliCleanupVersion: 1, conversationId: 1 }, v: 2 } :: caused by :: Expression not supported in partial index: $not
    _meiliCleanupVersion exists

Screenshots

bash
error: Index build failed for "Message": Error in specification { name: "meili_excluded_legacy_cleanup_v3", partialFilterExpression: { subagentTask: { $exists: true }, _meiliIndex: { $eq: false }, _meiliCleanupVersion: { $exists: false } }, background: true, key: { _meiliIndex: 1, _meiliCleanupVersion: 1, messageId: 1 }, v: 2 } :: caused by :: Expression not supported in partial index: $not
    _meiliCleanupVersion exists

error: Index build failed for "Conversation": Error in specification { name: "meili_excluded_legacy_cleanup_v3", partialFilterExpression: { subagentThread: { $exists: true }, _meiliIndex: { $eq: false }, _meiliCleanupVersion: { $exists: false } }, background: true, key: { _meiliIndex: 1, _meiliCleanupVersion: 1, conversationId: 1 }, v: 2 } :: caused by :: Expression not supported in partial index: $not
    _meiliCleanupVersion exists

Code of Conduct

  • I agree to follow this project's Code of Conduct