mem0ai/mem0 · error · Error
Must provide at least one of `connectionParams` and `client`
Error message
Must provide at least one of `connectionParams` and `client`
What it means
The OracleDB vector store constructor requires either connectionParams (so it can create its own pool/connection) or a pre-existing client (Connection or Pool from the node-oracledb driver). With neither, the store has no way to reach the database, so it fails fast at construction time.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/oracledb.ts:329
export class OracleAIVectorSearch implements VectorStore {
private readonly collectionName: string;
private readonly indexName: string;
private readonly embeddingModelDims: number;
private readonly distanceMetric: DistanceMetric;
private readonly indexType: IndexType;
private readonly indexParameters: Record<string, number>;
private readonly indexAccuracy?: number;
private readonly doCreateIndex: boolean;
private readonly config: OracleDBConfig;
private oracledb: any;
private client?: Connection | Pool;
private ownsClient = false;
private _initPromise?: Promise<void>;
constructor(config: OracleDBConfig) {
if (!config.connectionParams && !config.client) {
throw new Error(
"Must provide at least one of `connectionParams` and `client`",
);
}
this.collectionName = quoteIdentifier(config.collectionName || "mem0");
this.indexName = quoteIdentifier(
config.indexName || `${config.collectionName || "mem0"}_VEC_IDX`,
);
this.embeddingModelDims = config.embeddingModelDims ?? 1536;
if (
!Number.isInteger(this.embeddingModelDims) ||
this.embeddingModelDims <= 0
) {
throw new Error("`embeddingModelDims` must be a positive integer");
}
const distanceMetric = (config.distanceMetric ??View on GitHub (pinned to 001c235229)
Solutions
- Supply connectionParams: new OracleDB({ collectionName, connectionParams: { user, password, connectString } }).
- Or inject an existing driver object as client: new OracleDB({ collectionName, client: await oracledb.createPool(...) }).
- Check for typos — the keys must be exactly connectionParams and client.
- If loading from env, fail loudly when required ORACLE connection variables are missing rather than passing a partial config.
Example fix
// before
const vs = new OracleDB({ collectionName: 'mem0' });
// after
const vs = new OracleDB({
collectionName: 'mem0',
connectionParams: {
user: process.env.ORACLE_USER!,
password: process.env.ORACLE_PASSWORD!,
connectString: process.env.ORACLE_CONNECT_STRING!,
},
}); Defensive patterns
Strategy: type-guard
Validate before calling
function makeOracleConfig(env = process.env) {
const connectionParams = env.ORACLE_USER && env.ORACLE_PASSWORD && env.ORACLE_CONNECT_STRING
? { user: env.ORACLE_USER, password: env.ORACLE_PASSWORD, connectString: env.ORACLE_CONNECT_STRING }
: undefined;
if (!connectionParams && !existingClient) {
throw new Error('Missing ORACLE_USER/ORACLE_PASSWORD/ORACLE_CONNECT_STRING and no client provided');
}
return { collectionName: 'mem0', ...(connectionParams ? { connectionParams } : { client: existingClient }) };
} Type guard
function hasConnectionInput(cfg: unknown): cfg is { connectionParams: object } | { client: object } {
const c = cfg as Record<string, unknown>;
return (!!c.connectionParams && typeof c.connectionParams === 'object') || (!!c.client && typeof c.client === 'object');
} Try / catch
try { store = new OracleDB(config); } catch (e) { if (e instanceof Error && e.message.includes('connectionParams')) { /* fix config keys / load env, then retry construction */ } else throw e; } Prevention
- Fail loudly at startup when connection env vars are missing.
- Use exact keys: connectionParams or client.
- Centralize vector store config creation in one function covered by tests.
When it happens
Trigger: new OracleDB({ collectionName: 'mem0' } as any) with no connectionParams and no client; passing credentials under a misspelled key such as connectParams, connectionString-only configs, or config objects typed loosely (any) that silently omit both fields.
Common situations: Copy-pasting a config template and deleting the credentials block; refactoring env-var loading so ORACLE_* variables never populate connectionParams; passing a pool under an wrong property name (e.g. pool instead of client).
Related errors
- `embeddingModelDims` must be a positive integer
- Unsupported distance metric: ${config.distanceMetric}
- Unsupported index type: ${config.indexType}
- `indexAccuracy` must be an integer between 1 and 100
- Unknown LLM provider: ${providerId}
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/9e3fcb0422e18122.
Report an issue: GitHub.