SillyTavern/SillyTavern · warning

Not Found

Error message

Not Found

What it means

POST /api/themes/delete returns 404 'Not Found' when the resolved theme file does not exist on disk (fs.existsSync is false). The name was provided and valid, but no matching <name>.json lives in the user's themes directory.

Source

Thrown at src/endpoints/themes.js:30

        return response.sendStatus(400);
    }

    const filename = path.join(request.user.directories.themes, sanitize(`${request.body.name}.json`));
    writeFileAtomicSync(filename, JSON.stringify(request.body, null, 4), 'utf8');

    return response.sendStatus(200);
});

router.post('/delete', (request, response) => {
    if (!request.body || !request.body.name) {
        return response.sendStatus(400);
    }

    try {
        const filename = path.join(request.user.directories.themes, sanitize(`${request.body.name}.json`));
        if (!fs.existsSync(filename)) {
            console.error('Theme file not found:', filename);
            return response.sendStatus(404);
        }
        fs.unlinkSync(filename);
        return response.sendStatus(200);
    } catch (error) {
        console.error(error);
        return response.sendStatus(500);
    }
});

View on GitHub (pinned to 8172dcd0ee)

Solutions

  1. Refresh the theme list in the UI and retry against a currently-listed theme.
  2. Verify the exact name spelling and case against the themes directory contents.
  3. Treat a 404 on delete as a success if the goal is simply 'ensure it is gone'.
Defensive patterns

Strategy: try-catch

Validate before calling

// Only delete themes that currently appear in the fetched list
const list = await fetchThemeList();
if (!list.includes(name)) { console.info('Theme already absent'); return; }

Try / catch

// Treat 404 on delete as idempotent success
const res = await fetch('/api/themes/delete', opts);
if (res.status === 404) { console.info('Theme not present; nothing to delete'); return; }
if (!res.ok) throw new Error('Delete failed');

Prevention

When it happens

Trigger: Client requests deletion of a theme whose file is already gone, renamed, or whose name does not exactly match a file in the themes directory.

Common situations: Theme was already deleted but the UI list is stale; name casing/whitespace mismatch; file moved manually outside the app; concurrent delete by another session.

Related errors


AI-assisted analysis of SillyTavern/SillyTavern@8172dcd0ee (2026-08-13). Data as JSON: /api/errors/9844b9640706a744. Report an issue: GitHub.