apify/crawlee · error · Error
Cannot open storage with name "${name}" because an alias sto
Error message
Cannot open storage with name "${name}" because an alias storage with the same identifier already exists. If you meant to open the alias storage, use { alias: "${name}" } instead. What it means
The mirror case of the alias conflict: opening a storage with a `name` that collides with an already-open aliased storage of the same class and backend key. The error explicitly suggests using { alias: "<name>" } if you actually meant the aliased storage.
Source
Thrown at packages/core/src/storages/storage_instance_manager.ts:140
* Ensure that the same string is not used as both a name and an alias for the same
* storage class + backend combination. Mirrors crawlee-python's `_check_name_alias_conflict`.
*/
checkNameAliasConflict<T extends IStorage>(
cls: Constructor<T>,
{ name, alias, backendCacheKey }: { name?: string; alias?: string; backendCacheKey: Hashable },
): void {
if (alias) {
const existingByName = this.byName.get(cls)?.get(alias)?.get(backendCacheKey);
if (existingByName) {
throw new Error(
`Cannot open storage with alias "${alias}" because a named storage with the same identifier already exists.`,
);
}
}
if (name) {
const existingByAlias = this.byAlias.get(cls)?.get(name)?.get(backendCacheKey);
if (existingByAlias) {
throw new Error(
`Cannot open storage with name "${name}" because an alias storage with the same identifier already exists.` +
` If you meant to open the alias storage, use { alias: "${name}" } instead.`,
);
}
}
}
/** Iterate all cached instances across all storage types. */
*allValues(): IterableIterator<IStorage> {
const seen = new Set<IStorage>();
for (const classMap of this.byId.values()) {
for (const keyMap of classMap.values()) {
for (const instance of keyMap.values()) {
if (!seen.has(instance)) {
seen.add(instance);
yield instance;
}
}View on GitHub (pinned to dbe57fb09c)
Solutions
- Rename the storage name to a unique value
- Open with { alias: 'foo' } as the message suggests, to reuse the aliased storage
- Standardize on one convention (name or alias) across the codebase
- Close/clear the conflicting storage instance before reopening with the other identifier
Example fix
// before
await KeyValueStore.open({ alias: 'results' });
await KeyValueStore.open({ name: 'results' }); // throws
// after
await KeyValueStore.open({ alias: 'results' });
// or reuse: const store = await KeyValueStore.open({ alias: 'results' }); Defensive patterns
Strategy: validation
Validate before calling
function assertNoAliasNameConflict(openOpts) {
if (openOpts.name && openedAliases.has(openOpts.name)) {
throw new Error(`Name "${openOpts.name}" collides with an existing aliased storage`);
}
} Type guard
null
Try / catch
try {
store = await Dataset.open({ name });
} catch (err) {
if (/name .* because an alias storage/.test(String(err))) {
store = await Dataset.open({ alias: name });
} else throw err;
} Prevention
- Audit all open() call sites for mixed name/alias usage
- Adopt a lint rule or helper that wraps storage open with a single convention
- Reuse a single opened instance instead of reopening with different identifiers
When it happens
Trigger: Calling RequestQueue.open({ name: 'foo' }) after RequestQueue.open({ alias: 'foo' }) exists, for the same storage class and backend cache key, in the same process.
Common situations: Same as 122: mixed naming conventions across modules, migration from aliases back to names, shared runtimes (e.g. tests) opening the same identifier both ways.
Related errors
- Cannot open storage with alias "${alias}" because a named st
- AdaptivePlaywrightCrawler requires transactional storage - i
- The `minConcurrency`/`maxConcurrency`/`initialConcurrency`/`
- The `requestManager` option cannot be used in conjunction wi
- Cannot decide what to purge before running again: `sameDomai
AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30).
Data as JSON: /api/errors/12e4c8cfa3831eb4.
Report an issue: GitHub.