{"record":{"id":"362c2812b37debf5","repo":"usebruno/bruno","slug":"invalid-workspace-not-a-bruno-workspace","errorCode":null,"errorMessage":"Invalid workspace: not a bruno workspace","messagePattern":"Invalid workspace: not a bruno workspace","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/utils/workspace-config.js","lineNumber":303,"sourceCode":"\n  return yamlLines.join('\\n');\n};\n\nconst writeWorkspaceConfig = async (workspacePath, config) => {\n  return withLock(getWorkspaceLockKey(workspacePath), async () => {\n    const yamlContent = generateYamlContent(config);\n    await writeWorkspaceFileAtomic(workspacePath, yamlContent);\n  });\n};\n\nconst validateWorkspaceConfig = (config) => {\n  if (!config || typeof config !== 'object') {\n    throw new Error('Workspace configuration must be an object');\n  }\n\n  const type = config.info?.type || config.type;\n  if (type !== WORKSPACE_TYPE) {\n    throw new Error('Invalid workspace: not a bruno workspace');\n  }\n\n  const name = config.info?.name || config.name;\n  if (!name || typeof name !== 'string') {\n    throw new Error('Workspace must have a valid name');\n  }\n\n  return true;\n};\n\nconst updateWorkspaceName = async (workspacePath, newName) => {\n  return withLock(getWorkspaceLockKey(workspacePath), async () => {\n    const config = readWorkspaceConfig(workspacePath);\n    config.name = newName;\n    if (config.info) {\n      config.info.name = newName;\n    }\n    const yamlContent = generateYamlContent(config);","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/utils/workspace-config.js#L285-L321","documentation":"`validateWorkspaceConfig` reads `config.info?.type || config.type` and requires it to equal the `WORKSPACE_TYPE` constant (`'workspace'`). A file that is otherwise valid YAML but is a different Bruno entity (e.g. a collection) is rejected.","triggerScenarios":"Passing a parsed config whose `info.type`/`type` is `collection`, missing, or any value other than `'workspace'` to `validateWorkspaceConfig`.","commonSituations":"Pointing Bruno at a `bruno.json`/collection manifest that was mistakenly named `workspace.yml`; a hand-edited file where `type` was changed; cross-wiring a collection config into a workspace API.","solutions":["Confirm the file is a workspace manifest and that `info.type: workspace` is present.","If it is actually a collection, use the collection APIs instead of the workspace APIs.","Set `info.type: workspace` (or top-level `type: workspace`) when generating."],"exampleFix":"// before\ninfo:\n  name: MyThing\n  type: collection\n\n// after\ninfo:\n  name: MyWorkspace\n  type: workspace","handlingStrategy":"validation","validationCode":"function assertWorkspaceType(cfg) {\n  const type = cfg?.info?.type || cfg?.type;\n  if (type !== 'workspace') {\n    throw new Error(`Expected a workspace config, got type=${type}`);\n  }\n}","typeGuard":"function isWorkspaceManifest(cfg: unknown): boolean {\n  if (typeof cfg !== 'object' || cfg === null) return false;\n  const t = (cfg as any).info?.type ?? (cfg as any).type;\n  return t === 'workspace';\n}","tryCatchPattern":null,"preventionTips":["Do not reuse collection manifests as workspace manifests.","Pin info.type when generating config."],"tags":["workspace","config","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}