serverless/serverless · error · Error
Workspace directory must be a non-empty string
Error message
Workspace directory must be a non-empty string
What it means
Error "Workspace directory must be a non-empty string" thrown in serverless/serverless.
Source
Thrown at packages/mcp/src/lib/project-finder.js:20
import path from 'path'
import { promisify } from 'util'
import { execFile } from 'child_process'
import { enhanceProjectsWithServiceDetails } from './serverless-framework/service-details.js'
const execFileAsync = promisify(execFile)
const readFileAsync = promisify(fs.readFile)
const statAsync = promisify(fs.stat)
/**
* Validate that the provided path is an existing directory
*
* @param {string} dirPath - The directory path to validate
* @returns {Promise<string>} - The validated absolute path
* @throws {Error} - If the path is not a valid directory
*/
async function validateWorkspaceDir(dirPath) {
if (!dirPath || typeof dirPath !== 'string') {
throw new Error('Workspace directory must be a non-empty string')
}
// Resolve to absolute path to prevent relative path tricks
const absolutePath = path.resolve(dirPath)
// Verify the path exists and is a directory
const stats = await statAsync(absolutePath)
if (!stats.isDirectory()) {
throw new Error(`Path is not a directory: ${absolutePath}`)
}
return absolutePath
}
/**
* Find all Serverless Framework projects in the workspace
* Looks for serverless.yml files
*View on GitHub (pinned to b9d7ea51c8)
Solutions
- Pass a non-empty workspace directory path string to the project finder tool.
When it happens
Trigger: Thrown at packages/mcp/src/lib/project-finder.js:20 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of serverless/serverless@b9d7ea51c8 (2026-08-13).
Data as JSON: /api/errors/c0d558a7754f4d99.
Report an issue: GitHub.