n8n-io/n8n · error · NodeOperationError

Redis client not initialized

Error message

Redis client not initialized

What it means

NodeOperationError (with remediation description) thrown in `getVectorStoreClient` for the Redis vector store when `getRedisClient` returned `null` rather than a connected client. The node checks the client reference explicitly before proceeding to `ft.info`, because querying a null client would throw an opaque TypeError.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreRedis/VectorStoreRedis.node.ts:335

		],
		operationModes: ['load', 'insert', 'retrieve', 'update', 'retrieve-as-tool'],
	},
	methods: { listSearch: { redisIndexSearch: listIndexes } },
	retrieveFields,
	loadFields: retrieveFields,
	insertFields,
	sharedFields,
	async getVectorStoreClient(context, _filter, embeddings, itemIndex) {
		const client = await getRedisClient(context);
		const indexField = getIndexName(context, itemIndex).trim();
		const keyPrefixField = getKeyPrefix(context, itemIndex).trim();
		const metadataField = getMetadataKey(context, itemIndex).trim();
		const contentField = getContentKey(context, itemIndex).trim();
		const embeddingField = getEmbeddingKey(context, itemIndex).trim();
		const filter = getMetadataFilter(context, itemIndex).trim();

		if (client === null) {
			throw new NodeOperationError(context.getNode(), 'Redis client not initialized', {
				itemIndex,
				description: 'Please check your Redis connection details',
			});
		}

		// Check if index exists by trying to get info about it
		try {
			await client.ft.info(indexField);
		} catch (error) {
			throw new NodeOperationError(context.getNode(), `Index ${indexField} not found`, {
				itemIndex,
				description: 'Please check that the index exists in your Redis instance',
			});
		}

		// Process filter: split by comma, trim, and remove empty strings
		// If no valid filter terms exist, pass undefined instead of empty array
		const filterTerms = filter

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Open the node and select a valid Redis credential in the credential dropdown.
  2. Verify the credential has a non-empty host, port, and (if required) password.
  3. If the credential was deleted, recreate it and rebind the node to the new one.
  4. Check any expression bound to the credential parameter resolves to a credential id.

Example fix

// before
const client = await getRedisClient(context);
if (client === null) {
  throw new NodeOperationError(context.getNode(), 'Redis client not initialized', {
    itemIndex,
    description: 'Please check your Redis connection details',
  });
}

// after: fail fast at the credential boundary with a clearer message
const client = await getRedisClient(context);
if (!client) {
  throw new NodeOperationError(context.getNode(), 'Redis credential is not configured', {
    itemIndex,
    description: 'Select a Redis credential in the node, or create one with a valid host, port, and password.',
  });
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate at the credential boundary so a null client never reaches getVectorStoreClient.
function assertRedisClient(client: Redis | null): Redis {
  if (!client) {
    throw new NodeOperationError(/* node */, 'Redis credential is not configured', {
      description: 'Select a Redis credential with a valid host, port, and password.',
    });
  }
  return client;
}

Type guard

function isRedisClient(value: unknown): value is Redis {
  return value !== null && typeof value === 'object' && typeof (value as { ft?: unknown }).ft === 'object';
}

Try / catch

const client = await getRedisClient(context);
if (!isRedisClient(client)) {
  throw new NodeOperationError(context.getNode(), 'Redis client not initialized', {
    itemIndex,
    description: 'Please check your Redis connection details',
  });
}

Prevention

When it happens

Trigger: Redis credential is not configured (or the host is empty), so `getRedisClient` deliberately returns null instead of attempting a connection; the credential exists but the connection-string builder returned null due to a missing required field.

Common situations: Workflow saved without selecting a Redis credential; credential was deleted but the node still references it; the credential's host/port/password fields are blank; running in a templated workflow where the credential parameter resolves to nothing.

Related errors


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