Mintplex-Labs/anything-llm · error · Error

Error removing logo!

Error message

Error removing logo!

What it means

Thrown by System.removeCustomLogo when the request to /api/system/remove-logo returns non-2xx. baseHeaders() is sent, but no method is supplied to fetch — so the request defaults to GET against a route that is semantically a remove/delete operation. The .catch() returns {success:false, error:e.message}.

Source

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

      cache: "no-cache",
    })
      .then((res) => {
        if (!res.ok) throw new Error("Failed to get is default logo!");
        return res.json();
      })
      .then((res) => res?.isDefaultLogo)
      .catch((e) => {
        console.log(e);
        return null;
      });
  },
  removeCustomLogo: async function () {
    return await fetch(`${API_BASE}/system/remove-logo`, {
      headers: baseHeaders(),
    })
      .then((res) => {
        if (res.ok) return { success: true, error: null };
        throw new Error("Error removing logo!");
      })
      .catch((e) => {
        console.log(e);
        return { success: false, error: e.message };
      });
  },
  getApiKeys: async function () {
    return fetch(`${API_BASE}/system/api-keys`, {
      method: "GET",
      headers: baseHeaders(),
    })
      .then((res) => {
        if (!res.ok) {
          throw new Error(res.statusText || "Error fetching api key.");
        }
        return res.json();
      })
      .catch((e) => {

View on GitHub (pinned to 526360e320)

Solutions

  1. Confirm the HTTP method the backend /system/remove-logo route expects (likely DELETE) and pass it explicitly.
  2. Verify the caller is an admin (branding mutation).
  3. Ensure localStorage AUTH_TOKEN is present.
  4. Check the response status — 405 confirms the method mismatch.

Example fix

// before
return await fetch(`${API_BASE}/system/remove-logo`, { headers: baseHeaders() })

// after (explicit DELETE, matching the server route)
return await fetch(`${API_BASE}/system/remove-logo`, {
  method: "DELETE",
  headers: baseHeaders(),
})
Defensive patterns

Strategy: validation

Validate before calling

function canMutateLogo() {
  return isAdmin() && !!window.localStorage.getItem("anythingllm_authToken");
}
// Confirm the method matches the backend route (likely DELETE).

Type guard

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

Try / catch

if (!canMutateLogo()) return;
const res = await System.removeCustomLogo();
if (!isMutationResult(res) || !res.success) showError(res.error);

Prevention

When it happens

Trigger: Calling removeCustomLogo() when the backend expects DELETE/POST and rejects GET (405 Method Not Allowed), when no custom logo exists (404), or when the auth token is rejected (401/403).

Common situations: Backend route was changed to DELETE in a newer version and the frontend was not updated; a non-admin calls an admin-only branding route (403); the custom logo was already removed.

Related errors


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