{"record":{"id":"c0d558a7754f4d99","repo":"serverless/serverless","slug":"workspace-directory-must-be-a-non-empty-string","errorCode":null,"errorMessage":"Workspace directory must be a non-empty string","messagePattern":"Workspace directory must be a non-empty string","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/lib/project-finder.js","lineNumber":20,"sourceCode":"import path from 'path'\nimport { promisify } from 'util'\nimport { execFile } from 'child_process'\nimport { enhanceProjectsWithServiceDetails } from './serverless-framework/service-details.js'\n\nconst execFileAsync = promisify(execFile)\nconst readFileAsync = promisify(fs.readFile)\nconst statAsync = promisify(fs.stat)\n\n/**\n * Validate that the provided path is an existing directory\n *\n * @param {string} dirPath - The directory path to validate\n * @returns {Promise<string>} - The validated absolute path\n * @throws {Error} - If the path is not a valid directory\n */\nasync function validateWorkspaceDir(dirPath) {\n  if (!dirPath || typeof dirPath !== 'string') {\n    throw new Error('Workspace directory must be a non-empty string')\n  }\n\n  // Resolve to absolute path to prevent relative path tricks\n  const absolutePath = path.resolve(dirPath)\n\n  // Verify the path exists and is a directory\n  const stats = await statAsync(absolutePath)\n  if (!stats.isDirectory()) {\n    throw new Error(`Path is not a directory: ${absolutePath}`)\n  }\n\n  return absolutePath\n}\n\n/**\n * Find all Serverless Framework projects in the workspace\n * Looks for serverless.yml files\n *","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/packages/mcp/src/lib/project-finder.js#L2-L38","documentation":"Error \"Workspace directory must be a non-empty string\" thrown in serverless/serverless.","triggerScenarios":"Thrown at packages/mcp/src/lib/project-finder.js:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-empty workspace directory path string to the project finder tool."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}