usebruno/bruno · error · Error
Invalid workspace directory name: ${dirPath}
Error message
Invalid workspace directory name: ${dirPath} What it means
`validateWorkspaceDirectory` runs `validateName(path.basename(dirPath))` and throws when the directory's base name contains characters Bruno disallows. It is a name-sanitization guard used when creating/registering a workspace directory.
Source
Thrown at packages/bruno-electron/src/utils/workspace-config.js:186
if (!workspacePath) {
throw new Error('Workspace path is required');
}
if (!fs.existsSync(workspacePath)) {
throw new Error(`Workspace path does not exist: ${workspacePath}`);
}
const workspaceFilePath = path.join(workspacePath, 'workspace.yml');
if (!fs.existsSync(workspaceFilePath)) {
throw new Error('Invalid workspace: workspace.yml not found');
}
return true;
};
const validateWorkspaceDirectory = (dirPath) => {
if (!validateName(path.basename(dirPath))) {
throw new Error(`Invalid workspace directory name: ${dirPath}`);
}
return true;
};
const createWorkspaceConfig = (workspaceName) => ({
opencollection: OPENCOLLECTION_VERSION,
info: {
name: workspaceName,
type: WORKSPACE_TYPE
},
collections: [],
specs: [],
docs: ''
});
const normalizeWorkspaceConfig = (config) => {
// Coerce `specs` to an array once. A malformed workspace.yml (e.g. `specs`
// authored as a map) would otherwise flow through as a non-array and crashView on GitHub (pinned to 9bdd81c7bd)
Solutions
- Rename the folder to a clean, single-segment name with no special characters.
- Normalize the path (`path.normalize`) before deriving the basename.
- Generate the folder name from the workspace name using the same rules `validateName` enforces.
Example fix
// before
validateWorkspaceDirectory('/work/my "bad" workspace/');
// after
validateWorkspaceDirectory('/work/my-workspace'); Defensive patterns
Strategy: validation
Validate before calling
const path = require('path');
const { validateName } = require('./filesystem');
function ensureValidDirName(p) {
const base = path.basename(path.normalize(p));
if (!validateName(base)) throw new Error(`Invalid workspace directory name: ${base}`);
return p;
} Prevention
- Normalize paths before deriving the basename.
- Restrict workspace names to alphanumerics, dash, underscore in the UI.
When it happens
Trigger: Creating a workspace whose folder name fails `validateName` — typically disallowed characters or an empty/whitespace-only basename.
Common situations: Folder names with slashes, NULs, or OS-forbidden characters; a path that ended in a separator leaving an empty basename; copy-pasted names with quotes or control chars; non-normalized relative paths.
Related errors
- Workspace must have a valid name
- Workspace path not found
- No files selected
- Invalid file type: ${file.name}. Only JSON files are support
- ${request.filename} is not a valid filename
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/504febb5295ea359.
Report an issue: GitHub.