{"record":{"id":"cd6ca9a4921ad5a7","repo":"Mintplex-Labs/anything-llm","slug":"error-removing-logo","errorCode":null,"errorMessage":"Error removing logo!","messagePattern":"Error removing logo!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/models/system.js","lineNumber":539,"sourceCode":"      cache: \"no-cache\",\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Failed to get is default logo!\");\n        return res.json();\n      })\n      .then((res) => res?.isDefaultLogo)\n      .catch((e) => {\n        console.log(e);\n        return null;\n      });\n  },\n  removeCustomLogo: async function () {\n    return await fetch(`${API_BASE}/system/remove-logo`, {\n      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (res.ok) return { success: true, error: null };\n        throw new Error(\"Error removing logo!\");\n      })\n      .catch((e) => {\n        console.log(e);\n        return { success: false, error: e.message };\n      });\n  },\n  getApiKeys: async function () {\n    return fetch(`${API_BASE}/system/api-keys`, {\n      method: \"GET\",\n      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (!res.ok) {\n          throw new Error(res.statusText || \"Error fetching api key.\");\n        }\n        return res.json();\n      })\n      .catch((e) => {","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/system.js#L521-L557","documentation":"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}.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Confirm the HTTP method the backend /system/remove-logo route expects (likely DELETE) and pass it explicitly.","Verify the caller is an admin (branding mutation).","Ensure localStorage AUTH_TOKEN is present.","Check the response status — 405 confirms the method mismatch."],"exampleFix":"// before\nreturn await fetch(`${API_BASE}/system/remove-logo`, { headers: baseHeaders() })\n\n// after (explicit DELETE, matching the server route)\nreturn await fetch(`${API_BASE}/system/remove-logo`, {\n  method: \"DELETE\",\n  headers: baseHeaders(),\n})","handlingStrategy":"validation","validationCode":"function canMutateLogo() {\n  return isAdmin() && !!window.localStorage.getItem(\"anythingllm_authToken\");\n}\n// Confirm the method matches the backend route (likely DELETE).","typeGuard":"/** @param {any} r @returns {r is {success:boolean, error:string|null}} */\nfunction isMutationResult(r) { return r != null && typeof r.success === \"boolean\"; }","tryCatchPattern":"if (!canMutateLogo()) return;\nconst res = await System.removeCustomLogo();\nif (!isMutationResult(res) || !res.success) showError(res.error);","preventionTips":["Pass an explicit HTTP method matching the backend route (DELETE).","Gate behind admin role.","A 405 status means the method is wrong — fix the verb."],"tags":["network","branding","logo","delete","auth","method-mismatch"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}