{"record":{"id":"34143f26ba044c7f","repo":"usebruno/bruno","slug":"workspace-path-is-required-34143f","errorCode":null,"errorMessage":"Workspace path is required.","messagePattern":"Workspace path is required\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/app/mock-server/mock-response-store.js","lineNumber":306,"sourceCode":"  }\n\n  store.mockServers[mockServerUid] = {\n    ...existingBlock,\n    legacyMigrated: true,\n    responses: legacyResponses\n  };\n  writeWorkspaceStore(workspacePath, store);\n\n  return legacyResponses;\n};\n\nconst getMockServerResponses = (location) => {\n  if (!location?.mockServerUid) {\n    throw new Error('Mock server id is required.');\n  }\n\n  if (!location?.workspacePath) {\n    throw new Error('Workspace path is required.');\n  }\n\n  const store = readWorkspaceStore(location.workspacePath);\n  const responses = store.mockServers?.[location.mockServerUid]?.responses;\n\n  if (Array.isArray(responses) && responses.length > 0) {\n    return responses;\n  }\n\n  return migrateLegacyResponses(location);\n};\n\nconst setMockServerResponses = (location, responses) => {\n  const store = readWorkspaceStore(location.workspacePath);\n  const existing = store.mockServers[location.mockServerUid] || {};\n\n  store.mockServers[location.mockServerUid] = {\n    ...existing,","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/app/mock-server/mock-response-store.js#L288-L324","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ngetMockServerResponses({ mockServerUid: 'ms_1' }); // no workspacePath\n\n// after\ngetMockServerResponses({ mockServerUid: 'ms_1', workspacePath: '/abs/path/to/workspace' });","handlingStrategy":"validation","validationCode":"if (!location?.workspacePath || !path.isAbsolute(location.workspacePath)) {\n  throw new Error('Provide an absolute workspace path.');\n}","typeGuard":"const hasWorkspacePath = (l) => !!l && typeof l.workspacePath === 'string' && !!l.workspacePath;","tryCatchPattern":null,"preventionTips":["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."],"tags":["mock-server","validation","bruno-electron","ipc","input-validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}