Mintplex-Labs/anything-llm · error · Error

Error uploading logo.

Error message

Error uploading logo.

What it means

Thrown by System.uploadLogo on a non-2xx POST to /api/system/upload-logo. Same shape as uploadPfp: FormData body, baseHeaders() included, generic error message that discards the response body. The .catch() returns {success:false, error:e.message}.

Source

Thrown at frontend/src/models/system.js:325

      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) => {
        console.log(e);
        return { success: false, error: e.message };
      });
  },
  fetchCustomFooterIcons: async function () {
    const cache = window.localStorage.getItem(this.cacheKeys.footerIcons);
    const { data, lastFetched } = cache
      ? safeJsonParse(cache, { data: [], lastFetched: 0 })
      : { data: [], lastFetched: 0 };

    if (!!data && Date.now() - lastFetched < 3_600_000)
      return { footerData: data, error: null };

    const { footerData, error } = await fetch(
      `${API_BASE}/system/footer-data`,

View on GitHub (pinned to 526360e320)

Solutions

  1. Increase the reverse proxy max body size to accommodate the logo.
  2. Ensure only an admin role calls this (it modifies instance branding).
  3. Do not set Content-Type manually on the FormData request.
  4. Validate the image dimensions/format match the documented logo spec before uploading.
Defensive patterns

Strategy: validation

Validate before calling

function validLogoUpload(file) {
  return file instanceof File && file.type.startsWith("image/") && file.size <= 2_000_000;
}

Type guard

/** @param {any} r @returns {r is {success:boolean, error:string|null}} */
function isUploadResult(r) { return r != null && typeof r.success === "boolean"; }

Try / catch

if (!isAdmin()) return;
if (!validLogoUpload(file)) { setError("Invalid logo"); return; }
const res = await System.uploadLogo(fd);
if (!isUploadResult(res) || !res.success) setError(res.error);

Prevention

When it happens

Trigger: Calling uploadLogo(formData) when the logo file exceeds a proxy/server size cap (413), when the MIME type is not an allowed image type, when an interceptor forces a Content-Type on the multipart body, or when the user lacks admin rights (403).

Common situations: Non-admin user attempts to brand the instance; nginx/CDN body-size cap below the logo; transparent PNG rejected by a format whitelist; token expired before submit.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/25fcab37635b11ac. Report an issue: GitHub.