{"record":{"id":"25fcab37635b11ac","repo":"Mintplex-Labs/anything-llm","slug":"error-uploading-logo","errorCode":null,"errorMessage":"Error uploading logo.","messagePattern":"Error uploading logo\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/models/system.js","lineNumber":325,"sourceCode":"      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Error uploading pfp.\");\n        return { success: true, error: null };\n      })\n      .catch((e) => {\n        console.log(e);\n        return { success: false, error: e.message };\n      });\n  },\n  uploadLogo: async function (formData) {\n    return await fetch(`${API_BASE}/system/upload-logo`, {\n      method: \"POST\",\n      body: formData,\n      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Error uploading logo.\");\n        return { success: true, error: null };\n      })\n      .catch((e) => {\n        console.log(e);\n        return { success: false, error: e.message };\n      });\n  },\n  fetchCustomFooterIcons: async function () {\n    const cache = window.localStorage.getItem(this.cacheKeys.footerIcons);\n    const { data, lastFetched } = cache\n      ? safeJsonParse(cache, { data: [], lastFetched: 0 })\n      : { data: [], lastFetched: 0 };\n\n    if (!!data && Date.now() - lastFetched < 3_600_000)\n      return { footerData: data, error: null };\n\n    const { footerData, error } = await fetch(\n      `${API_BASE}/system/footer-data`,","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/system.js#L307-L343","documentation":"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}.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Increase the reverse proxy max body size to accommodate the logo.","Ensure only an admin role calls this (it modifies instance branding).","Do not set Content-Type manually on the FormData request.","Validate the image dimensions/format match the documented logo spec before uploading."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function validLogoUpload(file) {\n  return file instanceof File && file.type.startsWith(\"image/\") && file.size <= 2_000_000;\n}","typeGuard":"/** @param {any} r @returns {r is {success:boolean, error:string|null}} */\nfunction isUploadResult(r) { return r != null && typeof r.success === \"boolean\"; }","tryCatchPattern":"if (!isAdmin()) return;\nif (!validLogoUpload(file)) { setError(\"Invalid logo\"); return; }\nconst res = await System.uploadLogo(fd);\nif (!isUploadResult(res) || !res.success) setError(res.error);","preventionTips":["Gate the call behind an admin/manager check.","Do not manually set Content-Type on multipart bodies.","Validate dimensions/format against the documented logo spec."],"tags":["network","upload","multipart","branding","auth"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}