{"record":{"id":"05bf3284f667e37c","repo":"Mintplex-Labs/anything-llm","slug":"data-message-could-not-update-slash-command-pr","errorCode":null,"errorMessage":"data.message || \"Could not update slash command preset.\"","messagePattern":"data\\.message \\|\\| \"Could not update slash command preset\\.\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/models/system.js","lineNumber":749,"sourceCode":"        return data;\n      })\n      .then((res) => ({ preset: res.preset, error: null }))\n      .catch((e) => {\n        console.error(e);\n        return { preset: null, error: e.message };\n      });\n  },\n\n  updateSlashCommandPreset: async function (presetId, presetData) {\n    return await fetch(`${API_BASE}/system/slash-command-presets/${presetId}`, {\n      method: \"POST\",\n      headers: baseHeaders(),\n      body: JSON.stringify(presetData),\n    })\n      .then(async (res) => {\n        const data = await res.json();\n        if (!res.ok)\n          throw new Error(\n            data.message || \"Could not update slash command preset.\"\n          );\n        return data;\n      })\n      .then((res) => ({ preset: res.preset, error: null }))\n      .catch((e) => {\n        console.error(e);\n        return { preset: null, error: e.message };\n      });\n  },\n\n  deleteSlashCommandPreset: async function (presetId) {\n    return await fetch(`${API_BASE}/system/slash-command-presets/${presetId}`, {\n      method: \"DELETE\",\n      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Could not delete slash command preset.\");","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/models/system.js#L731-L767","documentation":"Thrown by updateSlashCommandPreset in the AnythingLLM frontend when POST /api/system/slash-command-presets/:presetId responds non-2xx, preferring the server's data.message over the generic fallback. The route updates a preset the caller owns, so it fails on unknown ids, non-owner access, and validation problems.","triggerScenarios":"Posting to a presetId that was deleted in another session (404); validation failure on the updated fields; a user editing a preset that belongs to someone else (403); database errors during the update.","commonSituations":"Stale preset list after edits in another tab; renamed command colliding with another preset; shared accounts editing the same preset concurrently.","solutions":["Re-fetch the preset list and retry with a presetId that still exists.","Keep the edited command unique among the user's presets.","Read the returned `error` for the server's field-level validation message.","Check server logs if the status looks like a 500 rather than 4xx."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// run before System.updateSlashCommandPreset\nif (!presetId) throw new Error('Preset id is required');\nif (!validPreset(presetData)) throw new Error('Command and name are required');\nif (!presets.some((p) => p.id === presetId)) {\n  throw new Error('Preset no longer exists — refresh the list');\n}","typeGuard":null,"tryCatchPattern":"const { preset, error } = await System.updateSlashCommandPreset(presetId, presetData);\nif (error) {\n  if (/not found/i.test(error)) await refreshPresets(); // stale id — reload and retry once\n  else showPresetError(error);\n  return;\n}","preventionTips":["Re-fetch the preset list before editing entries opened in other tabs.","Validate the payload with the same rules as creation.","Handle stale-id failures by refreshing instead of erroring out."],"tags":["anythingllm","slash-command-presets","validation","http"],"backgroundTag":"api-validation-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}