mem0ai/mem0 · error · Error
Vector with ID ${vectorId} not found
Error message
Vector with ID ${vectorId} not found What it means
updateVector in the S3 Vectors store supports partial updates: when the new vector is empty or the payload is missing, it fetches the stored vector to merge. If no stored vector with that ID exists, there is nothing to merge with and the update cannot proceed, so this error is thrown.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/s3_vectors.ts:229
}
throw error;
}
}
async update(
vectorId: string,
vector: number[],
payload: Record<string, any>,
): Promise<void> {
await this.initialize();
let nextVector = vector;
let nextPayload = payload || {};
if (vector.length === 0 || !payload) {
const existing = await this.fetchStoredVector(vectorId);
if (!existing) {
throw new Error(`Vector with ID ${vectorId} not found`);
}
nextVector = vector.length > 0 ? vector : existing.vector;
nextPayload = payload || existing.payload;
}
this.assertVectorDimension(nextVector, "Vector");
const sdk = await this.getSdk();
const client = await this.getClient();
await client.send(
new sdk.PutVectorsCommand({
vectorBucketName: this.vectorBucketName,
indexName: this.collectionName,
vectors: [
{
key: vectorId,
data: this.toVectorData(nextVector),
metadata: nextPayload,View on GitHub (pinned to 001c235229)
Solutions
- Check the memory exists before partial update (getVector / list) or simply add it instead
- Pass the full vector when updating potentially-missing IDs so the call becomes an upsert-style put
- Refresh cached IDs after collection recreation or bulk deletes
Example fix
// before
await s3vs.updateVector(id, [], { text: 'updated' }); // throws if absent
// after
const existing = await s3vs.getVector(id);
if (!existing) {
await s3vs.insert([/* embeddings */,], [id], [{ text: 'updated' }]);
} else {
await s3vs.updateVector(id, [], { text: 'updated' });
} Defensive patterns
Strategy: try-catch
Validate before calling
async function upsertVector(vs: any, id: string, vec: number[], payload: any) {
const existing = vec.length > 0 && payload ? null : await vs.getVector(id);
if (!existing && vec.length === 0) {
throw new Error(`Cannot partial-update missing vector ${id}; supply a full vector`);
}
await vs.updateVector(id, vec, payload);
} Type guard
const hasFullUpdateData = (vec: number[], payload?: any): boolean => vec.length > 0 && !!payload;
Try / catch
try {
await s3vs.updateVector(id, [], newPayload);
} catch (e) {
if (e instanceof Error && e.message.includes('not found')) {
await s3vs.insert([embedding], [id], [newPayload]); // create instead
} else throw e;
} Prevention
- Check existence (or always send the full vector) before partial updates
- Invalidate cached IDs after collection recreation or bulk deletes
- Model update-vs-create explicitly in your memory service instead of relying on upsert semantics
When it happens
Trigger: Calling updateVector(id, [], newPayload) for an ID that was never added or was already deleted; passing an empty vector array with a new ID; stale IDs held in application state after the collection was recreated.
Common situations: Retry logic reusing IDs after the underlying collection was dropped; updating memories deleted by another process; partial-update code paths that omit the vector for records that do not exist yet.
Related errors
- Method 'update' not supported by LangchainVectorStore wrappe
- vectorBucketName is required
- collectionName is required
- embeddingModelDims or dimension is required
- The '@aws-sdk/client-s3vectors' package is required to use t
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/653a1a3fa4fd4092.
Report an issue: GitHub.