Mintplex-Labs/anything-llm · error · Error
Failed to update default system prompt: ${error.message}
Error message
Failed to update default system prompt: ${error.message} What it means
The DefaultSystemPrompt admin page submits the trimmed prompt via System.updateDefaultSystemPrompt(newSystemPrompt) and throws inside the .then when the API answers success=false, using the server-provided message. The catch shows 'Failed to update default system prompt' — any server-side rejection of the update lands here.
Source
Thrown at frontend/src/pages/Admin/DefaultSystemPrompt/index.jsx:78
setSystemPromptForm((prev) => ({
...prev,
value,
isDirty,
isSubmitting: false,
}));
};
const handleSubmit = async (e) => {
e.preventDefault();
setSystemPromptForm((prev) => ({
...prev,
isSubmitting: true,
}));
const newSystemPrompt = systemPromptForm.value.trim();
await System.updateDefaultSystemPrompt(newSystemPrompt)
.then(({ success, message }) => {
if (!success) throw new Error(message);
// If the user has set the default system prompt to the sane default, reset the value to the sane default.
if (
!newSystemPrompt ||
newSystemPrompt.trim() === saneDefaultSystemPrompt
) {
return setSystemPromptForm((prev) => ({
...prev,
value: saneDefaultSystemPrompt,
}));
}
showToast("Default system prompt updated successfully.", "success");
setSystemPromptForm((prev) => ({
...prev,
default: newSystemPrompt,
isDirty: false,
isSubmitting: false,View on GitHub (pinned to 3aec848f28)
Solutions
- Confirm you are logged in as an admin or the instance owner.
- Read the exact message from the API response in the Network tab — it distinguishes permission vs storage failures.
- Re-login and resubmit if the token had expired.
- Check backend logs for the underlying storage error if the message is generic.
Defensive patterns
Strategy: validation
Validate before calling
// Guard the submit before calling the API
const value = systemPromptForm.value.trim();
if (typeof value !== 'string') return; // nothing to submit
if (!window.localStorage.getItem('auth_token')) {
showToast('Session expired — please log in again.', 'error');
return;
} Try / catch
await System.updateDefaultSystemPrompt(value)
.then(({ success, message }) => {
if (!success) throw new Error(message);
})
.catch((error) => {
showToast(`Failed to update default system prompt: ${error.message}`, 'error');
})
.finally(() => setSystemPromptForm((prev) => ({ ...prev, isSubmitting: false }))); Prevention
- Keep admin settings routes behind an auth check so expired sessions redirect to login instead of failing on submit.
- Always render the server's message — it distinguishes permission failures from storage failures.
- Reset isSubmitting in a finally block so a failure never leaves the form stuck.
When it happens
Trigger: Submitting the form while the admin session expired (401/403), hitting the update endpoint as a non-admin in multi-user mode, or a backend/storage failure while persisting the setting.
Common situations: Non-admin user reaches the admin settings page; token expired before submit; backend throws while writing the system prompt setting.
Related errors
- Failed to save agent flow. ${error.message}
- Community Hub connection key not found
- Failed to update default system prompt.
- System prompt variable not found
- Key is required
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/c6a05915c22d9f83.
Report an issue: GitHub.