{"record":{"id":"292a5b25371daa4b","repo":"SillyTavern/SillyTavern","slug":"handles-do-not-match","errorCode":null,"errorMessage":"Handles do not match","messagePattern":"Handles do not match","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"public/scripts/user.js","lineNumber":373,"sourceCode":"\n        const template = $(await renderTemplateAsync('deleteUser'));\n        template.find('#deleteUserName').text(handle);\n        template.find('input[name=\"deleteUserData\"]').on('input', function () {\n            purge = $(this).is(':checked');\n        });\n        template.find('input[name=\"deleteUserHandle\"]').on('input', function () {\n            confirmHandle = String($(this).val());\n        });\n\n        const result = await callGenericPopup(template, POPUP_TYPE.CONFIRM, '', { okButton: 'Delete', cancelButton: 'Cancel', wide: false, large: false });\n\n        if (result !== POPUP_RESULT.AFFIRMATIVE) {\n            throw new Error('Delete user cancelled');\n        }\n\n        if (handle !== confirmHandle) {\n            toastr.error('Handles do not match', 'Failed to delete user');\n            throw new Error('Handles do not match');\n        }\n\n        const response = await fetch('/api/users/delete', {\n            method: 'POST',\n            headers: getRequestHeaders(),\n            body: JSON.stringify({ handle, purge }),\n        });\n\n        if (!response.ok) {\n            const data = await response.json();\n            toastr.error(data.error || 'Unknown error', 'Failed to delete user');\n            throw new Error('Failed to delete user');\n        }\n\n        toastr.success('User deleted successfully', 'User Deleted');\n        callback();\n    } catch (error) {\n        console.error('Error deleting user:', error);","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/SillyTavern/SillyTavern/blob/8172dcd0ee672d3cd9a5e5f7af134f91a45cd2b8/public/scripts/user.js#L355-L391","documentation":"Thrown in `deleteUser` when the handle typed into the confirmation dialog (`confirmHandle`) does not equal the target `handle`. Deletion requires the user to retype the exact handle as confirmation.","triggerScenarios":"User types a different handle in the confirm box; case mismatch; leading/trailing whitespace; the confirm input was left empty or edited after auto-fill.","commonSituations":"Case-sensitive comparison trips up users; copy-paste introduces whitespace; the dialog's input default changed.","solutions":["Type the exact handle (the comparison is case-sensitive).","Trim whitespace from the confirmation value before comparing.","If scripted and confirmation is not wanted, skip the popup and POST to `/api/users/delete` directly."],"exampleFix":"// before\nif (handle !== confirmHandle) throw new Error('Handles do not match');\n// after\nif (handle !== confirmHandle.trim()) throw new Error('Handles do not match');","handlingStrategy":"validation","validationCode":"if (handle !== confirmHandle.trim()) throw new Error('Handles do not match');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim and compare case-sensitively as the server does.","Auto-fill the confirmation box and make it read-only for scripted flows."],"tags":["validation","user-management"],"backgroundTag":null,"analyzedSha":"8172dcd0ee672d3cd9a5e5f7af134f91a45cd2b8","analyzedAt":"2026-08-13T07:48:40.832Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}