{"record":{"id":"2b3220cd9751cc28","repo":"Mintplex-Labs/anything-llm","slug":"an-error-occurred-while-deleting-the-model","errorCode":null,"errorMessage":"An error occurred while deleting the model","messagePattern":"An error occurred while deleting the model","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/utils/lemonadeUtilsEndpoints.js","lineNumber":159,"sourceCode":"            model_name: String(modelId),\n          }),\n        });\n\n        const data = await lemonadeResponse.json();\n        if (!lemonadeResponse.ok || data.status === \"error\") {\n          return response.status(lemonadeResponse.status || 500).json({\n            success: false,\n            error: data.message || \"An error occurred while deleting the model\",\n          });\n        }\n\n        return response.status(200).json({\n          success: true,\n          message: data.message || `Deleted model: ${modelId}`,\n        });\n      } catch (e) {\n        console.error(e);\n        return response.status(500).json({\n          success: false,\n          error: e.message || \"An error occurred while deleting the model\",\n        });\n      }\n    }\n  );\n}\n\nmodule.exports = {\n  lemonadeUtilsEndpoints,\n};\n","sourceCodeStart":141,"sourceCodeEnd":171,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/utils/lemonadeUtilsEndpoints.js#L141-L171","documentation":"The failure reply from POST /utils/lemonade/delete-model when deletion on the Lemonade server does not succeed. Two paths produce it: the Lemonade /api/v1/delete HTTP response was non-ok and carried no message field (the literal fallback text is used), or the fetch itself threw (server down, wrong base path) and the catch returns e.message with the same fallback. Note that on the catch path e.message is usually non-empty, so seeing the literal string typically means a non-ok HTTP response.","triggerScenarios":"Lemonade server not running at the resolved base URL; basePath or LEMONADE_LLM_BASE_PATH pointing at the wrong host/port; deleting a model id that is not installed (404 without message); Lemonade busy/unloaded so the delete endpoint returns 5xx; URL construction throwing on a malformed basePath.","commonSituations":"Lemonade started on a non-default port while the client sends the default; inference server crashed mid-session; model already deleted by another tab; basePath passed with a trailing slash or missing scheme producing an invalid URL.","solutions":["Verify the Lemonade server is up and reachable at the resolved endpoint (default base path or the basePath you passed) - e.g. curl its root/models endpoint.","Confirm the modelId exists on that server before deleting; deleting an unknown id yields a non-ok response.","Correct basePath/LEMONADE_LLM_BASE_PATH (scheme + host + port, no duplicated path segments) and retry.","Check the server console - the catch branch console.errors the raw exception for fetch-level failures."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the Lemonade server is reachable before deleting\nasync function lemonadeOnline(basePath) {\n  const base = basePath || process.env.LEMONADE_LLM_BASE_PATH;\n  try {\n    const res = await fetch(new URL(\"models\", base));\n    return res.ok;\n  } catch { return false; }\n}\nif (!(await lemonadeOnline(basePath))) throw new Error(\"Lemonade server unreachable - start it or fix basePath\");","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(\"/api/utils/lemonade/delete-model\", { method: \"POST\", headers, body: JSON.stringify({ modelId, basePath }) });\n  const data = await res.json();\n  if (!res.ok) {\n    if (/Failed to fetch|ECONN|invalid URL/i.test(data.error)) fixBasePath();\n    else refreshModelList(); // model may already be gone\n  }\n} catch (e) { console.error(\"delete-model request failed:\", e.message); }","preventionTips":["Verify the Lemonade server is up and the base path correct before issuing deletes.","Refresh the installed-model list before deleting; stale ids produce non-ok responses.","Keep basePath and LEMONADE_LLM_BASE_PATH consistent across calls."],"tags":["lemonade","http","model-management","network"],"backgroundTag":"http-request-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}