n8n-io/n8n · critical · UnexpectedError

Weaviate store factory did not return an ExtendedWeaviateVec

Error message

Weaviate store factory did not return an ExtendedWeaviateVectorStore instance

What it means

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.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreWeaviate/VectorStoreWeaviate.node.ts:44

	fusionType?: 'Ranked' | 'RelativeScore';
	hybridExplainScore?: boolean;
};

class ExtendedWeaviateVectorStore extends WeaviateStore {
	private defaultFilter?: WeaviateCompositeFilter;
	private args!: WeaviateLibArgs;

	static async fromExistingCollection(
		embeddings: Embeddings,
		args: WeaviateLibArgs,
		defaultFilter?: WeaviateCompositeFilter,
	): Promise<ExtendedWeaviateVectorStore> {
		// Call parent factory method but bound to this (subclass) so the created instance is of the subclass
		const ctor = this as unknown as typeof ExtendedWeaviateVectorStore & typeof WeaviateStore;
		const baseCandidate = await ctor.fromExistingIndex(embeddings, args);

		if (!(baseCandidate instanceof ExtendedWeaviateVectorStore)) {
			throw new UnexpectedError(
				'Weaviate store factory did not return an ExtendedWeaviateVectorStore instance',
			);
		}

		const base = baseCandidate;

		// Attach per-instance config
		base.args = args;
		if (defaultFilter) {
			base.defaultFilter = defaultFilter;
		}

		return base;
	}

	async similaritySearchVectorWithScore(query: number[], k: number, filter?: IDataObject) {
		filter = filter ?? this.defaultFilter;
		const args = this.args;

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Update n8n (and thus the bundled nodes-langchain) to the latest patch — this is a code/contract bug, not a configuration issue.
  2. If reproducible on a specific version, downgrade to the last known-good n8n release until a fix ships.
  3. Collect the n8n, @n8n/nodes-langchain, langchain, and weaviate-ts versions and file a bug; the assertion exists precisely to catch this regression.
  4. As a workaround, avoid the load-existing-collection path (use a fresh Insert + Retrieve) if the workflow permits.

Example fix

// no user-side code fix — report the bug; the factory contract is:
//   ctor.fromExistingIndex(...) must return ExtendedWeaviateVectorStore
// workaround: repopulate the collection instead of loading an existing one.
Defensive patterns

Strategy: try-catch

Validate before calling

// there is no caller-side prevention; this is an internal contract assertion.
// detect the version combo at startup and warn:
if (!expectedFactoryContract(bundledVersions)) { warn('weaviate factory contract mismatch — update n8n'); }

Type guard

function isExtendedWeaviateStore(s: unknown): s is ExtendedWeaviateVectorStore { return s instanceof ExtendedWeaviateVectorStore; }

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/079a181e26c7bf70. Report an issue: GitHub.