moeru-ai/airi · error · Error
Identifier "{name}" is used more than once — names need to b
Error message
Identifier "{name}" is used more than once — names need to be unique. What it means
Thrown by buildConfigFile when a server identifier already exists in seenIdentifiers — two rows share the same trimmed name. The ElectronMcpStdioConfigFile.mcpServers is a keyed object, so duplicate keys would silently overwrite; this guard prevents that data loss.
Source
Thrown at apps/stage-tamagotchi/src/renderer/pages/settings/modules/mcp-config.ts:99
return config
}
/** Builds the persisted MCP config file from editable rows. */
export function buildConfigFile(
servers: ServerForm[],
translateMessage: TranslateMcpMessage,
): ElectronMcpStdioConfigFile {
const config: ElectronMcpStdioConfigFile = { mcpServers: {} }
const seenIdentifiers = new Set<string>()
for (const [index, server] of servers.entries()) {
const identifier = server.identifier.trim()
if (!identifier)
throw new Error(translateMessage('errors.empty-identifier', { index: index + 1 }))
if (seenIdentifiers.has(identifier))
throw new Error(translateMessage('errors.duplicate-identifier', { name: identifier }))
if (!server.command.trim())
throw new Error(translateMessage('errors.empty-command', { name: identifier }))
seenIdentifiers.add(identifier)
config.mcpServers[identifier] = buildServerConfig(server)
}
return config
}
/** Builds the JSON editor draft while preserving the current draft when form validation fails. */
export function syncJsonDraftFromServers(
servers: ServerForm[],
previousDraft: string,
translateMessage: TranslateMcpMessage,
formatError: (error: unknown) => string,
) {View on GitHub (pinned to 27111382b4)
Solutions
- Rename one of the colliding server rows to a unique identifier.
- If the duplicate is unintended, delete the extra row.
- Add live duplicate detection in the form (highlight duplicate identifiers before save).
Defensive patterns
Strategy: validation
Validate before calling
function hasDuplicateIdentifiers(servers: ServerForm[]): boolean {
const ids = servers.map(s => s.identifier.trim()).filter(Boolean)
return new Set(ids).size !== ids.length
} Type guard
function areIdentifiersUnique(servers: ServerForm[]): boolean {
const seen = new Set<string>()
for (const s of servers) {
const id = s.identifier.trim()
if (!id) continue
if (seen.has(id)) return false
seen.add(id)
}
return true
} Try / catch
try {
buildConfigFile(servers, t)
} catch (e) {
// highlight duplicate rows in the form
} Prevention
- Live-check for duplicate identifiers as the user types.
- Highlight colliding rows before Save is allowed.
- Auto-suffix duplicates (e.g. 'filesystem-2') if appropriate.
When it happens
Trigger: User entered the same identifier on two server rows (e.g. two 'filesystem' entries); pasted a config JSON that listed one server twice; rename left two rows colliding.
Common situations: Copy-pasting a server row without renaming; importing a hand-edited JSON with duplicate keys; merging two configs that share a server name.
Related errors
- Server # {index} is missing an identifier.
- errors.empty-command
- Invalid remote debug port: ${env.APP_REMOTE_DEBUG_PORT}
- No reachable private LAN address is available for the curren
- Failed to apply server channel configuration
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/a3c85bc3ee7c50f2.
Report an issue: GitHub.