Mintplex-Labs/anything-llm · error · Error
Error uploading pfp.
Error message
Error uploading pfp.
What it means
Thrown by uploadPfp in the AnythingLLM frontend when POST /api/system/upload-pfp (multipart FormData with the image) responds non-2xx; the message is fixed and hides the actual status. baseHeaders() only adds Authorization/X-Timezone/X-Language, so the browser still sets the multipart boundary correctly — a non-2xx here is a server-side rejection (auth, validation, or storage failure), not a header problem.
Solutions
- Re-upload a standard PNG or JPEG within the size limit.
- Confirm you are still logged in (token present in localStorage so Authorization is sent).
- On self-hosted: verify the server's storage output folder is writable by the app user; check server logs for the 500.
- Check the Network tab status code to distinguish 401 (auth), 413 (size), and 500 (storage).
Example fix
// before — post whatever the file input produced
const { success, error } = await System.uploadPfp(formData);
// after — validate the file before building FormData
if (!file.type.startsWith('image/')) return showError('Choose an image file');
if (file.size > MAX_AVATAR_BYTES) return showError('Image is too large');
const { success, error } = await System.uploadPfp(formData); Defensive patterns
Strategy: validation
Validate before calling
// run before System.uploadPfp
const MAX_BYTES = 5 * 1024 * 1024;
if (!(file instanceof File) || !file.type.startsWith('image/')) {
throw new Error('Choose a PNG or JPEG image');
}
if (file.size > MAX_BYTES) throw new Error('Image exceeds the size limit'); Type guard
/** @param {any} f @returns {f is File} */
function isImageFile(f) {
return f instanceof File && f.type.startsWith('image/') && f.size > 0;
} Try / catch
const { success, error } = await System.uploadPfp(formData);
if (!success) {
showUploadError(error); // 'Error uploading pfp.' — check Network tab for the real status
return;
} Prevention
- Validate MIME type and size client-side before building FormData.
- Keep sessions short-lived UIs re-authed; uploads are the first to fail on 401.
- On self-hosted, verify the storage output folder is writable by the app user.
When it happens
Trigger: Uploading a non-image or an image the server rejects; a file over the server's size limit (413); no auth token in localStorage so the Authorization header is null (401); the server's storage output folder not writable, making the write fail (500).
Common situations: Docker installs where the storage volume is read-only or owned by another user; dragging a HEIC/AVIF file the processor cannot handle; session expired after a long idle before saving the profile.
Related errors
- Error uploading logo.
- Could not validate login.
- data.message || "Could not update slash command preset."
- data.message || "Error creating slash command preset."
- Error downloading model
AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18).
Data as JSON: /api/errors/fd45c8e782585752.
Report an issue: GitHub.
Appendix: source
Thrown at frontend/src/models/system.js:310
return await fetch(`${API_BASE}/system/remove-folder`, {
method: "DELETE",
headers: baseHeaders(),
body: JSON.stringify({ name }),
})
.then((res) => res.ok)
.catch((e) => {
console.error(e);
return false;
});
},
uploadPfp: async function (formData) {
return await fetch(`${API_BASE}/system/upload-pfp`, {
method: "POST",
body: formData,
headers: baseHeaders(),
})
.then((res) => {
if (!res.ok) throw new Error("Error uploading pfp.");
return { success: true, error: null };
})
.catch((e) => {
console.log(e);
return { success: false, error: e.message };
});
},
uploadLogo: async function (formData) {
return await fetch(`${API_BASE}/system/upload-logo`, {
method: "POST",
body: formData,
headers: baseHeaders(),
})
.then((res) => {
if (!res.ok) throw new Error("Error uploading logo.");
return { success: true, error: null };
})
.catch((e) => {View on GitHub (pinned to 20f6d3546c)