{"record":{"id":"079a181e26c7bf70","repo":"n8n-io/n8n","slug":"weaviate-store-factory-did-not-return-an-extendedw","errorCode":null,"errorMessage":"Weaviate store factory did not return an ExtendedWeaviateVectorStore instance","messagePattern":"Weaviate store factory did not return an ExtendedWeaviateVectorStore instance","errorType":"exception","errorClass":"UnexpectedError","httpStatus":null,"severity":"critical","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreWeaviate/VectorStoreWeaviate.node.ts","lineNumber":44,"sourceCode":"\tfusionType?: 'Ranked' | 'RelativeScore';\n\thybridExplainScore?: boolean;\n};\n\nclass ExtendedWeaviateVectorStore extends WeaviateStore {\n\tprivate defaultFilter?: WeaviateCompositeFilter;\n\tprivate args!: WeaviateLibArgs;\n\n\tstatic async fromExistingCollection(\n\t\tembeddings: Embeddings,\n\t\targs: WeaviateLibArgs,\n\t\tdefaultFilter?: WeaviateCompositeFilter,\n\t): Promise<ExtendedWeaviateVectorStore> {\n\t\t// Call parent factory method but bound to this (subclass) so the created instance is of the subclass\n\t\tconst ctor = this as unknown as typeof ExtendedWeaviateVectorStore & typeof WeaviateStore;\n\t\tconst baseCandidate = await ctor.fromExistingIndex(embeddings, args);\n\n\t\tif (!(baseCandidate instanceof ExtendedWeaviateVectorStore)) {\n\t\t\tthrow new UnexpectedError(\n\t\t\t\t'Weaviate store factory did not return an ExtendedWeaviateVectorStore instance',\n\t\t\t);\n\t\t}\n\n\t\tconst base = baseCandidate;\n\n\t\t// Attach per-instance config\n\t\tbase.args = args;\n\t\tif (defaultFilter) {\n\t\t\tbase.defaultFilter = defaultFilter;\n\t\t}\n\n\t\treturn base;\n\t}\n\n\tasync similaritySearchVectorWithScore(query: number[], k: number, filter?: IDataObject) {\n\t\tfilter = filter ?? this.defaultFilter;\n\t\tconst args = this.args;","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreWeaviate/VectorStoreWeaviate.node.ts#L26-L62","documentation":"An internal assertion (UnexpectedError) in ExtendedWeaviateVectorStore.fromExistingCollection: it calls the parent WeaviateStore.fromExistingIndex bound to the subclass and requires the returned object to be an instance of ExtendedWeaviateVectorStore. If the factory returns a plain/base WeaviateStore, the contract is broken and this throws. Per n8n error semantics this class denotes a code bug, not user input.","triggerScenarios":"fromExistingCollection is invoked (e.g. when the node loads an existing Weaviate collection for retrieval) and the langchain/weaviate-ts factory returns a base store object that is not the n8n subclass — typically after a langchain or weaviate-ts version bump changes the factory's prototype chain or return shape.","commonSituations":"Dependency upgrade (langchain or @weaviate/weaviate-ts) where fromExistingIndex no longer respects the `this` binding n8n relies on; a code regression in the subclass factory wiring; mismatched bundled vs runtime dependency versions inside n8n.","solutions":["Update n8n (and thus the bundled nodes-langchain) to the latest patch — this is a code/contract bug, not a configuration issue.","If reproducible on a specific version, downgrade to the last known-good n8n release until a fix ships.","Collect the n8n, @n8n/nodes-langchain, langchain, and weaviate-ts versions and file a bug; the assertion exists precisely to catch this regression.","As a workaround, avoid the load-existing-collection path (use a fresh Insert + Retrieve) if the workflow permits."],"exampleFix":"// no user-side code fix — report the bug; the factory contract is:\n//   ctor.fromExistingIndex(...) must return ExtendedWeaviateVectorStore\n// workaround: repopulate the collection instead of loading an existing one.","handlingStrategy":"try-catch","validationCode":"// there is no caller-side prevention; this is an internal contract assertion.\n// detect the version combo at startup and warn:\nif (!expectedFactoryContract(bundledVersions)) { warn('weaviate factory contract mismatch — update n8n'); }","typeGuard":"function isExtendedWeaviateStore(s: unknown): s is ExtendedWeaviateVectorStore { return s instanceof ExtendedWeaviateVectorStore; }","tryCatchPattern":"try { const store = await ExtendedWeaviateVectorStore.fromExistingCollection(embeddings, args); } catch (e) { if (/did not return an ExtendedWeaviateVectorStore/.test(e.message)) { /* report bug + repopulate as workaround */ } else throw e; }","preventionTips":["Keep n8n updated so the bundled langchain/weaviate-ts versions stay aligned.","Avoid mixing custom dependency overrides inside the n8n runtime.","Reproduce on the latest patch before investigating further — these are usually fixed fast.","When reporting, include n8n + nodes-langchain + weaviate-ts versions."],"tags":["weaviate","vector-store","assertion","internal","version-mismatch"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}