SillyTavern/SillyTavern · warning · Error
Cannot delete yourself
Error message
Cannot delete yourself
What it means
Guard in `deleteUser` that prevents deleting the currently logged-in user (`handle === currentUser.handle`). It shows a toastr error and throws before any API call, so no request is sent.
Source
Thrown at public/scripts/user.js:350
}
toastr.success('Password changed successfully', 'Password Changed');
callback();
} catch (error) {
console.error('Error changing password:', error);
}
}
/**
* Delete a user.
* @param {string} handle User handle
* @param {function} callback Success callback
*/
async function deleteUser(handle, callback) {
try {
if (handle === currentUser.handle) {
toastr.error('Cannot delete yourself', 'Failed to delete user');
throw new Error('Cannot delete yourself');
}
let purge = false;
let confirmHandle = '';
const template = $(await renderTemplateAsync('deleteUser'));
template.find('#deleteUserName').text(handle);
template.find('input[name="deleteUserData"]').on('input', function () {
purge = $(this).is(':checked');
});
template.find('input[name="deleteUserHandle"]').on('input', function () {
confirmHandle = String($(this).val());
});
const result = await callGenericPopup(template, POPUP_TYPE.CONFIRM, '', { okButton: 'Delete', cancelButton: 'Cancel', wide: false, large: false });
if (result !== POPUP_RESULT.AFFIRMATIVE) {
throw new Error('Delete user cancelled');View on GitHub (pinned to 8172dcd0ee)
Solutions
- Pass a handle different from `currentUser.handle`.
- In the UI, disable or hide the delete action for the current user.
- Filter the current user out of any batch before deletion.
Example fix
// before for (const h of handles) await deleteUser(h, cb); // after for (const h of handles.filter(x => x !== currentUser.handle)) await deleteUser(h, cb);
Defensive patterns
Strategy: validation
Validate before calling
if (handle === currentUser.handle) throw new Error('Cannot delete yourself'); Type guard
const isNotSelf = h => h !== currentUser.handle;
Prevention
- Disable the delete control for the current user row.
- Filter self out of batch operations.
When it happens
Trigger: The user-management UI invokes `deleteUser` with the current user's own handle; a scripted batch deletion iterates over a list that includes the active account.
Common situations: Admin panel where the admin's own row exposes a delete button; bulk-delete script built from the user list without filtering self.
Related errors
- Image generation is not configured.
- Missing arguments
- Handles do not match
- Missing required fields
- Invalid handle
AI-assisted analysis of SillyTavern/SillyTavern@8172dcd0ee (2026-08-13).
Data as JSON: /api/errors/22ff28c805e14c6d.
Report an issue: GitHub.