SillyTavern/SillyTavern · error
Forbidden
Error message
Forbidden
What it means
Error "Forbidden" thrown in SillyTavern/SillyTavern.
Source
Thrown at src/endpoints/backgrounds.js:74
const filename = relativePath.split('/').pop() || relativePath;
imageFolderMap[filename] = meta.folderIds;
}
}
response.json({ folders, imageFolderMap });
} catch (error) {
console.error('[Backgrounds] Folders endpoint error:', error);
response.status(500).json({ error: 'Internal server error.' });
}
});
router.post('/delete', getFileNameValidationFunction('bg'), async function (request, response) {
try {
if (!request.body) return response.sendStatus(400);
if (request.body.bg !== sanitize(request.body.bg)) {
console.error('Malicious bg name prevented');
return response.sendStatus(403);
}
const fileName = path.join(request.user.directories.backgrounds, sanitize(request.body.bg));
if (!fs.existsSync(fileName)) {
console.error('BG file not found');
return response.sendStatus(400);
}
fs.unlinkSync(fileName);
invalidateThumbnail(request.user.directories, 'bg', request.body.bg);
// Remove metadata for deleted image
const relativePath = path.join('backgrounds', request.body.bg);
await removeMetadata(request.user.directories.root, relativePath).catch(err => {
console.warn('[Backgrounds] Failed to remove metadata:', err.message);
});
View on GitHub (pinned to 8172dcd0ee)
Solutions
- Use a background filename without path separators or special characters; the name failed sanitization.
- Do not attempt directory traversal (../) in the bg parameter.
When it happens
Trigger: Thrown at src/endpoints/backgrounds.js:74 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
AI-assisted analysis of SillyTavern/SillyTavern@8172dcd0ee (2026-08-13).
Data as JSON: /api/errors/96008d8c21514539.
Report an issue: GitHub.