mem0ai/mem0 · error · Error
collectionName is required for Upstash Vector.
Error message
collectionName is required for Upstash Vector.
What it means
The Upstash Vector store requires a collection name because Upstash organizes vectors per index/collection. The constructor throws at instantiation if config.collectionName is missing or empty — no network call is attempted.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/upstash_vector.ts:24
interface UpstashVectorConfig extends VectorStoreConfig {
collectionName: string;
url?: string;
token?: string;
/** Pre-configured Upstash Vector client instance (typed as `any` to keep
* the optional driver's types out of the published type declarations). */
client?: any;
}
type UpstashMetadata = Record<string, unknown>;
export class UpstashVector implements VectorStore {
private client!: Index<UpstashMetadata>;
private readonly config: UpstashVectorConfig;
private readonly collectionName: string;
constructor(config: UpstashVectorConfig) {
if (!config.collectionName) {
throw new Error("collectionName is required for Upstash Vector.");
}
if (!config.client && !(config.url && config.token)) {
throw new Error("Either a client or url and token must be provided.");
}
this.config = config;
this.collectionName = config.collectionName;
}
/**
* Lazily construct (or reuse) the Upstash Vector client, importing the
* optional `@upstash/vector` peer only when the store is first used so
* consumers that never touch Upstash Vector don't need it installed.
*/
private async ensureClient(): Promise<void> {
if (this.client) return;
const config = this.config;View on GitHub (pinned to 001c235229)
Solutions
- Create an index in the Upstash console and pass its name: config: { collectionName: 'memories', url, token }.
- Double-check the exact key is collectionName (camelCase), not indexName or collection_name.
- Set collectionName from an env var if it varies per environment (e.g. UPSTASH_COLLECTION).
Example fix
// before
new Memory({ vectorStore: { provider: 'upstash_vector', config: { url, token } } });
// after
new Memory({ vectorStore: { provider: 'upstash_vector', config: { collectionName: 'memories', url, token } } }); Defensive patterns
Strategy: validation
Validate before calling
if (!config?.collectionName) throw new Error('upstash_vector requires config.collectionName — create the index in the Upstash console first'); Type guard
const hasUpstashCollection = (cfg: { collectionName?: string }): cfg is { collectionName: string } => typeof cfg.collectionName === 'string' && cfg.collectionName.length > 0; Try / catch
try { new Memory({ vectorStore: { provider: 'upstash_vector', config } }); } catch (e) { if (e instanceof Error && e.message.includes('collectionName is required')) { /* prompt for index name / read from env */ } else throw e; } Prevention
- Validate required config fields in one place before constructing Memory
- Derive collectionName from env per environment
When it happens
Trigger: new Memory({ vectorStore: { provider: 'upstash_vector', config: { url, token } } }) with no collectionName; passing collectionName: '' or undefined; copy-pasting config from another provider that has no collection concept.
Common situations: Migrating from a store without collections (e.g. pgvector with tableName); forgetting to create/name the Upstash index first; typos like collection_name or indexName in the config object.
Related errors
- Unknown LLM provider: ${providerId}
- Unknown embedder provider: ${providerId}
- ${label} has unknown keys: ${unknown.join(", ")}
- openclaw-mem0 config required
- Langchain embedder provider requires an initialized Langchai
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/54f6aadf8227b852.
Report an issue: GitHub.