Mintplex-Labs/anything-llm · error · Error
Failed to update default system prompt.
Error message
Failed to update default system prompt.
What it means
Thrown by POST /system/default-system-prompt when SystemSettings.updateSettings returns { success: false }. The thrown Error uses error.message when present, falling back to this string only when the failure carried no message. updateSettings is the generic system-settings persistence layer (typically a DB upsert), so the real cause is whatever made that layer report failure.
Source
Thrown at server/endpoints/system.js:893
console.error("Error fetching default system prompt:", error);
response
.status(500)
.json({ success: false, message: "Internal server error" });
}
}
);
app.post(
"/system/default-system-prompt",
[validatedRequest, flexUserRoleValid([ROLES.admin])],
async (request, response) => {
try {
const { defaultSystemPrompt } = reqBody(request);
const { success, error } = await SystemSettings.updateSettings({
default_system_prompt: defaultSystemPrompt,
});
if (!success)
throw new Error(
error.message || "Failed to update default system prompt."
);
response.status(200).json({
success: true,
message: "Default system prompt updated successfully.",
});
} catch (error) {
console.error("Error updating default system prompt:", error);
response.status(500).json({
success: false,
message: error.message || "Internal server error",
});
}
}
);
app.delete(
"/system/remove-pfp",View on GitHub (pinned to 526360e320)
Solutions
- Inspect server logs — the console.error in the catch logs the underlying error with its real message.
- Confirm the database is reachable and the system_settings table exists (run migrations).
- Reduce the prompt length and retry to rule out a size constraint.
- If the inner error is transient (lock/timeout), retry the save.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const { success, error } = await SystemSettings.updateSettings({ default_system_prompt: prompt });
if (!success) throw new Error(error?.message || 'updateSettings failed');
} catch (e) {
logger.error('default-system-prompt update failed', { cause: e });
res.status(500).json({ success: false, message: e.message });
} Prevention
- Log the inner error object to capture the real DB message.
- Validate prompt length on the client to avoid DB size constraints.
- Ensure migrations are applied so system_settings exists.
When it happens
Trigger: An admin saves a new default system prompt but the database write fails, a validation inside updateSettings rejects the value, or the settings table/row is locked or missing. The fallback text appears only when the inner error object had no message.
Common situations: Database connection dropped mid-request; the prompt text exceeded a column size limit; a migration left the system_settings table in an unexpected state; Prisma threw a constraint violation.
Related errors
- Internal Server Error
- Internal Server Error
- ${res.statusText || "Error fetching api keys."}
- ${res.statusText || "Error generating api key."}
- ${response.error || "Failed to create system prompt"}
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/687c3e2707712e3e.
Report an issue: GitHub.