{"record":{"id":"d63581c4f87c4317","repo":"n8n-io/n8n","slug":"redis-client-not-initialized","errorCode":null,"errorMessage":"Redis client not initialized","messagePattern":"Redis client not initialized","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreRedis/VectorStoreRedis.node.ts","lineNumber":335,"sourceCode":"\t\t],\n\t\toperationModes: ['load', 'insert', 'retrieve', 'update', 'retrieve-as-tool'],\n\t},\n\tmethods: { listSearch: { redisIndexSearch: listIndexes } },\n\tretrieveFields,\n\tloadFields: retrieveFields,\n\tinsertFields,\n\tsharedFields,\n\tasync getVectorStoreClient(context, _filter, embeddings, itemIndex) {\n\t\tconst client = await getRedisClient(context);\n\t\tconst indexField = getIndexName(context, itemIndex).trim();\n\t\tconst keyPrefixField = getKeyPrefix(context, itemIndex).trim();\n\t\tconst metadataField = getMetadataKey(context, itemIndex).trim();\n\t\tconst contentField = getContentKey(context, itemIndex).trim();\n\t\tconst embeddingField = getEmbeddingKey(context, itemIndex).trim();\n\t\tconst filter = getMetadataFilter(context, itemIndex).trim();\n\n\t\tif (client === null) {\n\t\t\tthrow new NodeOperationError(context.getNode(), 'Redis client not initialized', {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'Please check your Redis connection details',\n\t\t\t});\n\t\t}\n\n\t\t// Check if index exists by trying to get info about it\n\t\ttry {\n\t\t\tawait client.ft.info(indexField);\n\t\t} catch (error) {\n\t\t\tthrow new NodeOperationError(context.getNode(), `Index ${indexField} not found`, {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'Please check that the index exists in your Redis instance',\n\t\t\t});\n\t\t}\n\n\t\t// Process filter: split by comma, trim, and remove empty strings\n\t\t// If no valid filter terms exist, pass undefined instead of empty array\n\t\tconst filterTerms = filter","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreRedis/VectorStoreRedis.node.ts#L317-L353","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the node and select a valid Redis credential in the credential dropdown.","Verify the credential has a non-empty host, port, and (if required) password.","If the credential was deleted, recreate it and rebind the node to the new one.","Check any expression bound to the credential parameter resolves to a credential id."],"exampleFix":"// before\nconst client = await getRedisClient(context);\nif (client === null) {\n  throw new NodeOperationError(context.getNode(), 'Redis client not initialized', {\n    itemIndex,\n    description: 'Please check your Redis connection details',\n  });\n}\n\n// after: fail fast at the credential boundary with a clearer message\nconst client = await getRedisClient(context);\nif (!client) {\n  throw new NodeOperationError(context.getNode(), 'Redis credential is not configured', {\n    itemIndex,\n    description: 'Select a Redis credential in the node, or create one with a valid host, port, and password.',\n  });\n}","handlingStrategy":"validation","validationCode":"// Validate at the credential boundary so a null client never reaches getVectorStoreClient.\nfunction assertRedisClient(client: Redis | null): Redis {\n  if (!client) {\n    throw new NodeOperationError(/* node */, 'Redis credential is not configured', {\n      description: 'Select a Redis credential with a valid host, port, and password.',\n    });\n  }\n  return client;\n}","typeGuard":"function isRedisClient(value: unknown): value is Redis {\n  return value !== null && typeof value === 'object' && typeof (value as { ft?: unknown }).ft === 'object';\n}","tryCatchPattern":"const client = await getRedisClient(context);\nif (!isRedisClient(client)) {\n  throw new NodeOperationError(context.getNode(), 'Redis client not initialized', {\n    itemIndex,\n    description: 'Please check your Redis connection details',\n  });\n}","preventionTips":["Always select a Redis credential in the node before running.","Verify the credential has host, port, and password populated.","Recreate the credential if it was deleted and rebind the node."],"tags":["redis","vector-store","credentials","configuration","node-operation-error","langchain"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}