{"record":{"id":"bb76afdddb05c588","repo":"usebruno/bruno","slug":"workspace-path-is-required-bb76af","errorCode":null,"errorMessage":"Workspace path is required","messagePattern":"Workspace path is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/utils/workspace-config.js","lineNumber":169,"sourceCode":"\nconst normalizeCollectionEntry = (workspacePath, collection) => {\n  const relativePath = makeRelativePath(workspacePath, collection.path);\n\n  const normalizedCollection = {\n    name: collection.name,\n    path: relativePath\n  };\n\n  if (collection.remote) {\n    normalizedCollection.remote = collection.remote;\n  }\n\n  return normalizedCollection;\n};\n\nconst validateWorkspacePath = (workspacePath) => {\n  if (!workspacePath) {\n    throw new Error('Workspace path is required');\n  }\n\n  if (!fs.existsSync(workspacePath)) {\n    throw new Error(`Workspace path does not exist: ${workspacePath}`);\n  }\n\n  const workspaceFilePath = path.join(workspacePath, 'workspace.yml');\n  if (!fs.existsSync(workspaceFilePath)) {\n    throw new Error('Invalid workspace: workspace.yml not found');\n  }\n\n  return true;\n};\n\nconst validateWorkspaceDirectory = (dirPath) => {\n  if (!validateName(path.basename(dirPath))) {\n    throw new Error(`Invalid workspace directory name: ${dirPath}`);\n  }","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/utils/workspace-config.js#L151-L187","documentation":"`validateWorkspacePath` rejects a falsy `workspacePath` argument before it ever touches the filesystem. It is the first guard in the workspace-config validation chain; callers must hand it a real directory path.","triggerScenarios":"Any caller passes `undefined`, `null`, `''`, or `0` as `workspacePath` to `validateWorkspacePath` — typically a missing argument from an IPC handler or a destructured config field that was absent.","commonSituations":"An Electron IPC event that forgot to forward `workspacePath`; a fresh install where the path was never selected; a refactor that renamed the field; a test that called the function with no args.","solutions":["Pass the absolute directory path returned by the folder picker / persisted workspace record.","Check the caller (IPC handler, store) to confirm `workspacePath` is populated before invoking.","Surface a user-facing 'select a workspace' prompt instead of calling the validator with nothing."],"exampleFix":"// before\nvalidateWorkspacePath(undefined);\n\n// after\nvalidateWorkspacePath(selectedWorkspace.path);","handlingStrategy":"validation","validationCode":"function ensureWorkspacePath(p) {\n  if (!p || typeof p !== 'string') {\n    throw new Error('Select a workspace before continuing.');\n  }\n  return p;\n}\nconst wsPath = ensureWorkspacePath(selectedWorkspace?.path);","typeGuard":"function isNonEmptyString(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0;\n}","tryCatchPattern":"try { validateWorkspacePath(wsPath); }\ncatch (e) { /* prompt user to pick a workspace */ }","preventionTips":["Default workspacePath to undefined in the store and gate UI actions on its presence.","Type IPC payloads so a missing path is a compile error, not a runtime throw."],"tags":["workspace","config","validation","electron"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}