krisk/Fuse · error · Error
Object query syntax is not available in this build
Error message
Object query syntax is not available in this build
What it means
Object (field) query syntax like { title: { $contains: 'x' } } requires the extended-search object compiler, which is optional in some builds. When the query parser auto-detects an object query and getObjectCompiler() returns nothing (feature not bundled or not registered), it throws this error rather than failing later with an opaque message.
Source
Thrown at src/core/queryParser.ts:118
return obj
}
// Object ("MongoDB-style") operator leaf. Retain the raw operator object
// so the AST identifies the query even when searcher-free; build the
// searcher only when `auto` (mirrors the string leaf's gating). The
// compiler lives behind the extended-search flag: if it isn't registered
// (dev `Fuse.parseQuery` on a minimal build), throw a clear error rather
// than silently misbehave.
if (isObjectLike(value) && !isArray(value)) {
const obj: ParsedLeaf = {
keyId: createKeyId(key),
fieldQuery: value
}
if (auto) {
const compile = getObjectCompiler()
if (!compile) {
throw new Error(ErrorMsg.OBJECT_QUERY_UNAVAILABLE)
}
const keyPath = isArray(key) ? key.join('.') : String(key)
obj.searcher = compile(value, keyPath, options)
}
return obj
}
throw new Error(ErrorMsg.LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key))
}
const node: ParsedOperator = {
children: [],
operator: keys[0]
}
keys.forEach((key) => {
const value = query[key]View on GitHub (pinned to edf2fb608e)
Solutions
- Import the full fuse.js entry point (which includes extended search) instead of a basic/minimal one.
- Enable extended search support (EXTENDED_SEARCH_ENABLED) so the compiler is registered.
- Rewrite the query as a plain string or logical expression supported by the current build.
Example fix
// before (basic build)
import Fuse from 'fuse.js/basic'
fuse.search({ title: { $contains: 'world' } })
// after
import Fuse from 'fuse.js'
process.env.EXTENDED_SEARCH_ENABLED = '1'
fuse.search({ title: { $contains: 'world' } }) Defensive patterns
Strategy: fallback
Validate before calling
const usesObjectQuery = (q) =>
q !== null && typeof q === 'object' &&
Object.values(q).some(v => v !== null && typeof v === 'object')
if (usesObjectQuery(query) && !extendedSearchAvailable()) {
query = toPlainStringQuery(query) // degrade before calling search
}
fuse.search(query) Type guard
const hasObjectCompiler = () => typeof getObjectCompiler() === 'function'
Try / catch
try {
return fuse.search(query)
} catch (e) {
if (e.message.includes('Object query syntax is not available')) {
return fuse.search(toPlainStringQuery(query))
}
throw e
} Prevention
- Import the full fuse.js entry when using extended/object queries.
- Verify the compiler survives tree-shaking in your build.
- Keep query builders aligned with the imported build's features.
When it happens
Trigger: Passing a query object with per-field operator values to fuse.search() in a build where the object-query compiler is unavailable (e.g. the basic/minimal entry point, or extended search not enabled).
Common situations: Using the basic Fuse build with extended-search syntax; switching from the full bundle to a tree-shaken/lite entry; copying extended-search examples into an app importing a minimal build.
Related errors
- Extended search is not available
- Invalid value for key ${key}
- Invalid field query for key '${key}': ${reason}
AI-assisted analysis of krisk/Fuse@edf2fb608e (2026-09-02).
Data as JSON: /api/errors/ca8f5f8bb4b357d2.
Report an issue: GitHub.