SillyTavern/SillyTavern · error · Error
Failed to import world info: ${result.statusText}
Error message
Failed to import world info: ${result.statusText} What it means
Thrown when the POST to `/api/worldinfo/import` (multipart/form-data upload of a world-info file) returns a non-OK HTTP status. `result.statusText` is appended so the server's reason (e.g. 'Bad Request', 'Internal Server Error') surfaces to the user. On success the handler reads `data.name` and refreshes the world list.
Source
Thrown at public/scripts/world-info.js:5793
}
const worldName = file.name.substr(0, file.name.lastIndexOf('.'));
const sanitizedWorldName = await getSanitizedFilename(worldName);
const allowed = await checkOverwriteExistingData('World Info', world_names, sanitizedWorldName, { interactive: true, actionName: 'Import', deleteAction: (existingName) => deleteWorldInfo(existingName) });
if (!allowed) {
return false;
}
try {
const result = await fetch('/api/worldinfo/import', {
method: 'POST',
headers: getRequestHeaders({ omitContentType: true }),
body: formData,
cache: 'no-cache',
});
if (!result.ok) {
throw new Error(`Failed to import world info: ${result.statusText}`);
}
const data = await result.json();
if (data.name) {
await updateWorldInfoList();
const newIndex = world_names.indexOf(data.name);
if (newIndex >= 0) {
$('#world_editor_select').val(newIndex).trigger('change');
}
toastr.success(t`World Info "${data.name}" imported successfully!`);
}
} catch (error) {
console.error('Error importing world info:', error);
toastr.error(t`Failed to import World Info`);
}View on GitHub (pinned to 8172dcd0ee)
Solutions
- Open the world-info file locally and validate it is well-formed JSON with the expected entry schema.
- Check the server console for the matching 4xx/5xx and its detail; fix the flagged field (often a duplicate name or schema violation).
- Verify the `worlds` directory is writable and not full, then retry the import.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
function isValidWorldInfoJson(text) {
try {
const obj = JSON.parse(text);
} catch {
return false;
}
return true;
}
// before upload
if (!isValidWorldInfoJson(await file.text())) {
toastr.error('World info file is not valid JSON.');
return;
} Type guard
null
Try / catch
try {
await importWorldInfo(formData);
} catch (e) {
toastr.error(`Import failed: ${e.message}`);
} Prevention
- Validate the file is well-formed JSON before uploading.
- Keep world-info files under the server's body-size limit.
- Ensure the `worlds` data directory is writable.
When it happens
Trigger: Uploading a world-info JSON/file via the import flow when the server rejects the payload — malformed JSON, oversized body, missing form field, I/O error writing to the worlds directory, or a name collision the server won't auto-resolve.
Common situations: Importing a corrupted or hand-edited .json world file; hitting an Express body-size limit; read-only or permission-denied `worlds/` data folder; importing a file whose name contains characters the filesystem rejects.
Related errors
- Merge API returned ${response.status}
- Failed to caption image via Multimodal API.
- Got response status ${response.status}
- Got response status ${response.status}
- Upload failed with status ${result.status}
AI-assisted analysis of SillyTavern/SillyTavern@8172dcd0ee (2026-08-13).
Data as JSON: /api/errors/5862a6d3c865ba1b.
Report an issue: GitHub.