usebruno/bruno · error · Error
Workspace path is required.
Error message
Workspace path is required.
What it means
Thrown by getMockServerResponses when location.mockServerUid is truthy but location.workspacePath is falsy. The workspace store is read by workspacePath, so a missing path makes it impossible to locate the storage file. This is the second guard in getMockServerResponses, evaluated after the uid check.
Source
Thrown at packages/bruno-electron/src/app/mock-server/mock-response-store.js:306
}
store.mockServers[mockServerUid] = {
...existingBlock,
legacyMigrated: true,
responses: legacyResponses
};
writeWorkspaceStore(workspacePath, store);
return legacyResponses;
};
const getMockServerResponses = (location) => {
if (!location?.mockServerUid) {
throw new Error('Mock server id is required.');
}
if (!location?.workspacePath) {
throw new Error('Workspace path is required.');
}
const store = readWorkspaceStore(location.workspacePath);
const responses = store.mockServers?.[location.mockServerUid]?.responses;
if (Array.isArray(responses) && responses.length > 0) {
return responses;
}
return migrateLegacyResponses(location);
};
const setMockServerResponses = (location, responses) => {
const store = readWorkspaceStore(location.workspacePath);
const existing = store.mockServers[location.mockServerUid] || {};
store.mockServers[location.mockServerUid] = {
...existing,View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Pass an absolute workspace path in location.workspacePath (the same path used to save the mock server).
- When building location from an instance, spread the relevant fields: `{ mockServerUid: inst.uid, workspacePath: inst.workspacePath }`.
- Resolve the workspace path from the active workspace before invoking.
Example fix
// before
getMockServerResponses({ mockServerUid: 'ms_1' }); // no workspacePath
// after
getMockServerResponses({ mockServerUid: 'ms_1', workspacePath: '/abs/path/to/workspace' }); Defensive patterns
Strategy: validation
Validate before calling
if (!location?.workspacePath || !path.isAbsolute(location.workspacePath)) {
throw new Error('Provide an absolute workspace path.');
} Type guard
const hasWorkspacePath = (l) => !!l && typeof l.workspacePath === 'string' && !!l.workspacePath;
Prevention
- Pass an absolute workspace path alongside the mock server uid.
- When building location from an instance, copy instance.workspacePath explicitly.
- Resolve the path from the active workspace before invoking.
When it happens
Trigger: Calling getMockServerResponses({ mockServerUid }) with no workspacePath; a caller that built the location from a mock-server instance object but forgot to copy workspacePath; relative paths that resolved to an empty string.
Common situations: IPC payload carrying only the mock server id (e.g. after the workspace was closed and its path dropped); passing a mock-server instance where workspacePath lives under instance.workspacePath but was not spread into location.
Related errors
- Mock server id is required.
- API spec path is required.
- Mock server id is required.
- Could not reach the mock server
- Mock response draft not found
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/34143f26ba044c7f.
Report an issue: GitHub.