{"record":{"id":"53d494ae661c7fca","repo":"FlowiseAI/Flowise","slug":"cannot-provide-both-filter-and-this-filter-53d494","errorCode":null,"errorMessage":"cannot provide both `filter` and `this.filter`","messagePattern":"cannot provide both `filter` and `this\\.filter`","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Zep/Zep.ts","lineNumber":243,"sourceCode":"            )\n        }\n\n        this.collection = await this.client.document.addCollection({\n            name: args.collectionName,\n            description: args.description,\n            metadata: args.metadata,\n            embeddingDimensions: args.embeddingDimensions,\n            isAutoEmbedded: false\n        })\n    }\n\n    async similaritySearchVectorWithScore(\n        query: number[],\n        k: number,\n        filter?: Record<string, unknown> | undefined\n    ): Promise<[Document, number][]> {\n        if (filter && this.filter) {\n            throw new Error('cannot provide both `filter` and `this.filter`')\n        }\n        const _filters = filter ?? this.filter\n        const ANDFilters = []\n        for (const filterKey in _filters) {\n            let filterVal = _filters[filterKey]\n            if (typeof filterVal === 'string') filterVal = `\"${filterVal}\"`\n            ANDFilters.push({ jsonpath: `$[*] ? (@.${filterKey} == ${filterVal})` })\n        }\n        const newfilter = {\n            where: { and: ANDFilters }\n        }\n        await this.initializeCollection(this.args!).catch((err) => {\n            console.error('Error initializing collection:', err)\n            throw err\n        })\n        const results = await this.collection.search(\n            {\n                embedding: new Float32Array(query),","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Zep/Zep.ts#L225-L261","documentation":"similaritySearchVectorWithScore() rejects calls when a runtime `filter` argument is passed AND the store instance was constructed with an instance filter (this.filter). This mirrors upstream LangChain JS ZepVectorStore behavior; the two filter sources are mutually exclusive to avoid ambiguity about which one applies.","triggerScenarios":"Caller invokes similaritySearchVectorWithScore(query, k, filterObj) on a ZepVectorStore whose constructor config included a `filter` (Flowise wires zepMetadataFilter into the store config).","commonSituations":"Flowise passes zepMetadataFilter through the store config AND a per-query filter at call time; custom code reuses a long-lived store instance that was constructed with a filter and then passes another filter per query.","solutions":["Pick one filter source: either set zepMetadataFilter on the store config OR pass filter at call time — not both.","If per-query filtering is required, construct the store without zepMetadataFilter and pass the filter at each similaritySearch call.","If the store must hold a default filter, do not pass a runtime filter; clear this.filter (re-instantiate) before passing one."],"exampleFix":"// before: store built with filter AND runtime filter passed\nconst store = new ZepVectorStore({ ..., filter: defaultFilter })\nstore.similaritySearchVectorWithScore(q, k, perQueryFilter) // throws\n\n// after: pick one source\nconst store = new ZepVectorStore({ ... }) // no instance filter\nstore.similaritySearchVectorWithScore(q, k, perQueryFilter)","handlingStrategy":"validation","validationCode":"// Ensure only one filter source is used\nfunction assertSingleFilterSource(instanceFilter, runtimeFilter) {\n    if (instanceFilter && runtimeFilter) {\n        throw new Error('Pass filter either at construction OR at call time, not both')\n    }\n}","typeGuard":"function canPassRuntimeFilter(store) {\n    return !store.filter // only safe when no instance filter is set\n}","tryCatchPattern":"try {\n    await store.similaritySearchVectorWithScore(query, k, filter)\n} catch (e) {\n    if (/cannot provide both/i.test(e.message)) {\n        // rebuild the store without zepMetadataFilter and retry with the runtime filter\n    }\n    throw e\n}","preventionTips":["Pick one filter channel: instance config OR per-call filter.","If you need per-query filters, construct the store without zepMetadataFilter.","Document the chosen filter convention for callers of the store."],"tags":["zep","filter","similarity-search","configuration"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}