{"record":{"id":"12e4c8cfa3831eb4","repo":"apify/crawlee","slug":"cannot-open-storage-with-name-name-because-an","errorCode":null,"errorMessage":"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.","messagePattern":"Cannot open storage with name \"(.+?)\" because an alias storage with the same identifier already exists\\. If you meant to open the alias storage, use (.+?) instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/storages/storage_instance_manager.ts","lineNumber":140,"sourceCode":"     * Ensure that the same string is not used as both a name and an alias for the same\n     * storage class + backend combination. Mirrors crawlee-python's `_check_name_alias_conflict`.\n     */\n    checkNameAliasConflict<T extends IStorage>(\n        cls: Constructor<T>,\n        { name, alias, backendCacheKey }: { name?: string; alias?: string; backendCacheKey: Hashable },\n    ): void {\n        if (alias) {\n            const existingByName = this.byName.get(cls)?.get(alias)?.get(backendCacheKey);\n            if (existingByName) {\n                throw new Error(\n                    `Cannot open storage with alias \"${alias}\" because a named storage with the same identifier already exists.`,\n                );\n            }\n        }\n        if (name) {\n            const existingByAlias = this.byAlias.get(cls)?.get(name)?.get(backendCacheKey);\n            if (existingByAlias) {\n                throw new Error(\n                    `Cannot open storage with name \"${name}\" because an alias storage with the same identifier already exists.` +\n                        ` If you meant to open the alias storage, use { alias: \"${name}\" } instead.`,\n                );\n            }\n        }\n    }\n\n    /** Iterate all cached instances across all storage types. */\n    *allValues(): IterableIterator<IStorage> {\n        const seen = new Set<IStorage>();\n        for (const classMap of this.byId.values()) {\n            for (const keyMap of classMap.values()) {\n                for (const instance of keyMap.values()) {\n                    if (!seen.has(instance)) {\n                        seen.add(instance);\n                        yield instance;\n                    }\n                }","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/core/src/storages/storage_instance_manager.ts#L122-L158","documentation":"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.","triggerScenarios":"Calling RequestQueue.open({ name: 'foo' }) after RequestQueue.open({ alias: 'foo' }) exists, for the same storage class and backend cache key, in the same process.","commonSituations":"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.","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"],"exampleFix":"// before\nawait KeyValueStore.open({ alias: 'results' });\nawait KeyValueStore.open({ name: 'results' }); // throws\n// after\nawait KeyValueStore.open({ alias: 'results' });\n// or reuse: const store = await KeyValueStore.open({ alias: 'results' });","handlingStrategy":"validation","validationCode":"function assertNoAliasNameConflict(openOpts) {\n  if (openOpts.name && openedAliases.has(openOpts.name)) {\n    throw new Error(`Name \"${openOpts.name}\" collides with an existing aliased storage`);\n  }\n}","typeGuard":"null","tryCatchPattern":"try {\n  store = await Dataset.open({ name });\n} catch (err) {\n  if (/name .* because an alias storage/.test(String(err))) {\n    store = await Dataset.open({ alias: name });\n  } else throw err;\n}","preventionTips":["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"],"tags":["storage","naming-conflict","configuration"],"backgroundTag":"storage-identifier-conflict","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}