{"record":{"id":"05725946365adca0","repo":"RocketChat/Rocket.Chat","slug":"custom-sound-error-name-already-in-use","errorCode":"Custom_Sound_Error_Name_Already_In_Use","errorMessage":"The custom sound name is already in use","messagePattern":"The custom sound name is already in use","errorType":"error_code","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/media/custom-sounds/lib/insertOrUpdateSound.ts","lineNumber":34,"sourceCode":"\t\t});\n\t}\n\n\t// allow all characters except colon, whitespace, comma, >, <, &, \", ', /, \\, (, )\n\t// more practical than allowing specific sets of characters; also allows foreign languages\n\tconst nameValidation = /[\\s,:><&\"'\\/\\\\\\(\\)]/;\n\n\tif (nameValidation.test(soundData.name)) {\n\t\tthrow new Meteor.Error('error-input-is-not-a-valid-field', `${soundData.name} is not a valid name`, {\n\t\t\tmethod: 'insertOrUpdateSound',\n\t\t\tinput: soundData.name,\n\t\t\tfield: 'Name',\n\t\t});\n\t}\n\n\tconst conflictingSound = await CustomSounds.findOneByName(soundData.name, soundData._id, { projection: { _id: 1 } });\n\n\tif (conflictingSound) {\n\t\tthrow new Meteor.Error('Custom_Sound_Error_Name_Already_In_Use', 'The custom sound name is already in use', {\n\t\t\tmethod: 'insertOrUpdateSound',\n\t\t});\n\t}\n\n\tif (!soundData._id) {\n\t\treturn (\n\t\t\tawait CustomSounds.create({\n\t\t\t\tname: soundData.name,\n\t\t\t\textension: soundData.extension,\n\t\t\t})\n\t\t).insertedId;\n\t}\n\n\tif (soundData.newFile) {\n\t\tawait RocketChatFileCustomSoundsInstance.deleteFile(`${soundData._id}.${soundData.previousExtension}`);\n\t}\n\n\tif (soundData.name !== soundData.previousName || soundData.extension !== soundData.previousExtension) {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/media/custom-sounds/lib/insertOrUpdateSound.ts#L16-L52","documentation":"Error \"The custom sound name is already in use\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/server/lib/media/custom-sounds/lib/insertOrUpdateSound.ts:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different sound name; another custom sound already uses this name.","Delete or rename the existing custom sound with the conflicting name first."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}