jackwener/OpenCLI · error
Multiple collections share the name "${raw}" (ids: ${ids}).
Error message
Multiple collections share the name "${raw}" (ids: ${ids}). Pass the numeric collection_id explicitly to disambiguate. What it means
Thrown when more than one collection in the account has the same name (case-insensitive match). Name-based deletion would be ambiguous, so the tool refuses and asks for the numeric collection_id. This protects against deleting the wrong duplicate.
Source
Thrown at clis/instagram/collection-delete.js:62
let id = '';
let resolvedName = '';
if (isNumericId) {
const hit = collections.find((c) => String(c?.collection_id) === raw);
if (!hit) {
throw new Error('Collection id not found in your account: ' + raw);
}
id = String(hit.collection_id);
resolvedName = String(hit.collection_name || '');
} else {
const wanted = raw.toLowerCase();
const matches = collections.filter((c) => String(c?.collection_name || '').trim().toLowerCase() === wanted);
if (matches.length === 0) {
const names = collections.map((c) => c?.collection_name).filter(Boolean);
throw new Error('Collection not found: ' + raw + '. Available: ' + (names.length ? names.join(', ') : '(none)'));
}
if (matches.length > 1) {
const ids = matches.map((c) => c.collection_id).join(', ');
throw new Error('Multiple collections share the name "' + raw + '" (ids: ' + ids + '). Pass the numeric collection_id explicitly to disambiguate.');
}
id = String(matches[0].collection_id);
resolvedName = String(matches[0].collection_name || raw);
}
const fd = new FormData();
fd.append('module_name', 'collection_settings');
const res = await fetch('https://www.instagram.com/api/v1/collections/' + encodeURIComponent(id) + '/delete/', {
method: 'POST',
credentials: 'include',
headers: { ...headers, 'X-CSRFToken': csrf },
body: fd,
});
if (!res.ok) {
const body = await res.text().catch(() => '');
throw new Error('Failed to delete collection: HTTP ' + res.status + (body ? ' - ' + body.slice(0, 200) : ''));
}
const d = await res.json().catch(() => ({}));View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run passing the numeric collection_id of the specific collection to delete (ids are listed in the error)
- List collections to map ids to creation dates and pick the right one
- Rename duplicates in the Instagram UI to unique names for future name-based operations
- Dedupe collections before running name-based deletes
Example fix
// before node collection-delete.js --target "Travel" // ambiguous // after node collection-delete.js --target 17895600000000001 // explicit id from error message
Defensive patterns
Strategy: validation
Validate before calling
const list = await listCollections();
const matches = list.filter((c) => c.collection_name.trim().toLowerCase() === name.toLowerCase());
if (matches.length > 1) {
throw new Error('Ambiguous name; pass one of ids: ' + matches.map((m) => m.collection_id).join(', '));
} Type guard
function isUnambiguousName(name: string, collections: {collection_name: string}[]): boolean {
const w = name.trim().toLowerCase();
return collections.filter((c) => c.collection_name.trim().toLowerCase() === w).length === 1;
} Try / catch
try {
await deleteCollection(name);
} catch (e) {
if (String(e.message).startsWith('Multiple collections share the name')) {
console.error(e.message); // contains candidate ids
return; // require explicit id from operator
}
throw e;
} Prevention
- Use numeric collection_id for all automated deletes
- Keep collection names unique in the account
- Dedupe same-named collections before running batch deletes
- Parse candidate ids out of the error message when it does fire
When it happens
Trigger: Instagram allows duplicate collection names; calling delete by name when two or more collections share that exact trimmed/lowercased name.
Common situations: Users creating same-named collections over time (e.g. 'Travel' twice); automation accidentally creating duplicates previously; syncing across devices duplicating collections.
Related errors
- Collection id not found in your account: ${raw}
- Collection not found: ${raw}. Available: ${(names.length ? n
- Cannot resolve aid for bvid: ${bvid}
- Model name "${rawName}" is ambiguous.
- Picker option "${rawLabel}" is ambiguous.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/8dd372c63f04b243.
Report an issue: GitHub.