{"record":{"id":"9b828fe444ff3077","repo":"Mintplex-Labs/anything-llm","slug":"e-message-9b828f","errorCode":null,"errorMessage":"e.message","messagePattern":"e\\.message","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/agentSkillWhitelist.js","lineNumber":24,"sourceCode":"  ROLES,\n} = require(\"../utils/middleware/multiUserProtected\");\n\nfunction agentSkillWhitelistEndpoints(app) {\n  if (!app) return;\n\n  app.get(\n    \"/agent-skills/filesystem-agent/is-available\",\n    [validatedRequest],\n    async (_request, response) => {\n      try {\n        const filesystemTool = require(\"../utils/agents/aibitat/plugins/filesystem/lib\");\n        return response\n          .status(200)\n          .json({ available: filesystemTool.isToolAvailable() });\n      } catch (e) {\n        console.error(e);\n        return response\n          .status(500)\n          .json({ available: false, error: e.message });\n      }\n    }\n  );\n\n  app.get(\n    \"/agent-skills/create-files-agent/is-available\",\n    [validatedRequest],\n    async (_request, response) => {\n      try {\n        const createFilesTool = require(\"../utils/agents/aibitat/plugins/create-files/lib\");\n        return response\n          .status(200)\n          .json({ available: createFilesTool.isToolAvailable() });\n      } catch (e) {\n        console.error(e);\n        return response\n          .status(500)","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/agentSkillWhitelist.js#L6-L42","documentation":"GET /agent-skills/filessystem-agent/is-available responds 500 with {available:false, error:e.message} when require('../utils/agents/aibitat/plugins/filesystem/lib') fails or isToolAvailable() throws. In stock builds isToolAvailable only reads env vars (true when NODE_ENV=development or ANYTHING_LLM_RUNTIME=docker), so it virtually never throws; the realistic cause is the require failing in trimmed/custom installs.","triggerScenarios":"The filesystem plugin module or one of its transitive deps (e.g. 'diff') missing from node_modules — partial install, tree-shaken docker image, or file removed; a syntax/require error inside the plugin's dependency graph.","commonSituations":"Custom Docker images that prune files; npm install interrupted; upgrading with lockfile drift where 'diff' was dropped.","solutions":["Run require('server/utils/agents/aibitat/plugins/filesystem/lib') in node on the server host to surface the module-resolution error directly","Reinstall dependencies (npm ci) so the plugin's dependency graph is complete","Treat the `available:false` in the response as authoritative and disable the filesystem skill in the UI until fixed"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"async function filesystemAgentAvailable() {\n  try {\n    const res = await fetch('/api/agent-skills/filesystem-agent/is-available');\n    const body = await res.json();\n    return body.available === true;\n  } catch {\n    return false; // endpoint itself failing means treat as unavailable\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const { available } = await checkAvailability('filesystem-agent');\n  if (!available) disableSkillUI('filesystem-agent');\n} catch (err) {\n  disableSkillUI('filesystem-agent'); // fallback: feature off on any error\n  console.warn('availability probe failed:', err.message);\n}","preventionTips":["Never hard-fail a page on the availability probe — always degrade to 'skill unavailable'","After dependency changes, smoke-test the require chain: node -e \"require('.../filesystem/lib')\"","Expect available:false outside docker/development; it reflects ANYTHING_LLM_RUNTIME and NODE_ENV, not an error"],"tags":["agent-skills","http-500","require-failure","availability-check"],"backgroundTag":"missing-optional-dependency","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}