usebruno/bruno · error · Error
API spec file not found.
Error message
API spec file not found.
What it means
The spec passed the registration allowlist, but `fs.existsSync(resolvedPath)` is false - the file recorded in workspace.yml no longer exists on disk. A stale registration.
Source
Thrown at packages/bruno-electron/src/ipc/mock-server/index.js:48
};
const readWorkspaceSpec = (workspacePath, specPath) => {
if (!specPath) {
throw new Error('API spec path is required.');
}
validateWorkspacePath(workspacePath);
const resolvedPath = path.resolve(specPath);
const isRegisteredSpec = getWorkspaceApiSpecs(workspacePath)
.some((spec) => spec.path && path.resolve(spec.path) === resolvedPath);
if (!isRegisteredSpec) {
throw new Error('API spec is not registered in this workspace.');
}
if (!fs.existsSync(resolvedPath)) {
throw new Error('API spec file not found.');
}
return parseSpecContent(fs.readFileSync(resolvedPath, 'utf8'));
};
const registerMockServerIpc = (mainWindow) => {
mockServer.setMainWindow(mainWindow);
ipcMain.handle('renderer:mock-server-suggest-port', async (_event, payload = {}) => {
try {
const startPort = Number(payload.startPort) || undefined;
const port = await mockServer.suggestPort(startPort, {
additionalUsedPorts: payload.additionalUsedPorts || []
});
return { success: true, port };
} catch (err) {
return { success: false, error: err.message };
}View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Restore or relocate the spec file and update workspace.yml to match.
- Re-register the spec at its new path via the UI or addApiSpecToWorkspace.
- On a case-sensitive filesystem, fix the casing in workspace.yml to match disk exactly.
Example fix
// before: workspace.yml references specs/petstore.yaml but the file moved to specs/v2/petstore.yaml
// after: update workspace.yml
specs:
- name: petstore
path: specs/v2/petstore.yaml Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs'), path = require('path');
const specOnDisk = (specPath) => fs.existsSync(path.resolve(specPath)); Prevention
- When moving spec files, update workspace.yml in the same change.
- Re-validate registered specs on workspace open.
- Mind path casing on case-sensitive filesystems.
When it happens
Trigger: The spec file was moved/renamed/deleted after registration; the workspace is on a removable/remote drive that's unmounted; case-sensitivity mismatch between the recorded path and the filesystem (Linux).
Common situations: Refactoring a repo that moved `specs/`; cross-platform path casing; external drive not mounted.
Related errors
- API spec path is required.
- API spec is not registered in this workspace.
- Failed to export ${environmentType} environments.
- Failed to process ${parsedFile.fileName}: ${err.message}
- Failed to parse the file – ensure it is valid JSON or YAML
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/c5d8edc73a644462.
Report an issue: GitHub.