SillyTavern/SillyTavern · error · Error

No script name provided.

Error message

No script name provided.

What it means

Thrown by onRegexImportObjectChange during regex object import when the incoming regexScript has no scriptName. A script name is required to register the script (it is the user-facing identifier and used for toggling/listing), so an import payload missing it is rejected before a UUID is assigned and the script pushed.

Source

Thrown at public/scripts/extensions/regex/index.js:1502

    await saveRegexScript(script, index, scriptType);
    if (script.disabled) {
        !quiet && toastr.success(t`Regex script '${scriptName}' has been disabled.`);
    } else {
        !quiet && toastr.success(t`Regex script '${scriptName}' has been enabled.`);
    }

    return script.scriptName || '';
}

/**
 * Performs the import of the regex object.
 * @param {RegexScript} regexScript Input object
 * @param {SCRIPT_TYPES} scriptType The type of script to import as
 */
async function onRegexImportObjectChange(regexScript, scriptType) {
    try {
        if (!regexScript.scriptName) {
            throw new Error('No script name provided.');
        }

        // Assign a new UUID
        regexScript.id = uuidv4();

        const array = getScriptsByType(scriptType);
        array.push(regexScript);

        switch (scriptType) {
            case SCRIPT_TYPES.GLOBAL:
                // will be handled by saveSettingsDebounced
                break;
            case SCRIPT_TYPES.SCOPED:
                await saveScriptsByType(array, SCRIPT_TYPES.SCOPED);
                break;
            case SCRIPT_TYPES.PRESET:
                await saveScriptsByType(array, SCRIPT_TYPES.PRESET);
                break;

View on GitHub (pinned to 8172dcd0ee)

Solutions

  1. Ensure the import object has a non-empty scriptName: regexScript.scriptName = regexScript.scriptName || 'Imported Script'.
  2. Validate the payload schema before import: assert typeof obj.scriptName === 'string' && obj.scriptName.trim().
  3. If importing from a UI, require the name field and disable import until filled.

Example fix

// before
{ "findRegex": "/foo/g", "replaceString": "bar" }

// after
{ "scriptName": "Foo to Bar", "findRegex": "/foo/g", "replaceString": "bar" }
Defensive patterns

Strategy: validation

Validate before calling

if (typeof regexScript.scriptName !== 'string' || regexScript.scriptName.trim().length === 0) {
    throw new Error('Cannot import: regexScript.scriptName is missing or empty');
}
await onRegexImportObjectChange(regexScript, scriptType);

Type guard

/** @param {unknown} x */
const hasScriptName = (x) => typeof x?.scriptName === 'string' && x.scriptName.trim().length > 0;

Try / catch

try { await onRegexImportObjectChange(regexScript, scriptType); }
catch (e) { if (/No script name/.test(e.message)) { console.warn('skipping unnamed regex import'); } else throw e; }

Prevention

When it happens

Trigger: Importing a JSON regex object whose scriptName field is empty/missing; a malformed export file; programmatic import of a partial object.

Common situations: Hand-edited regex JSON lacking the name; third-party regex packs with inconsistent schema; converting a find/replace snippet into an import object and forgetting the name.

Related errors


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