{"record":{"id":"885adc522bd8eec8","repo":"usebruno/bruno","slug":"workspace-must-have-a-valid-name","errorCode":null,"errorMessage":"Workspace must have a valid name","messagePattern":"Workspace must have a valid name","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/utils/workspace-config.js","lineNumber":308,"sourceCode":"  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);\n    await writeWorkspaceFileAtomic(workspacePath, yamlContent);\n    return config;\n  });\n};\n","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/utils/workspace-config.js#L290-L326","documentation":"`validateWorkspaceConfig` requires a non-empty string name at `config.info?.name || config.name`. Without a name the workspace is rejected even if the type is correct.","triggerScenarios":"A parsed config with `type: workspace` but `info.name`/`name` that is undefined, empty, or not a string.","commonSituations":"Hand-edited `workspace.yml` with the `name` line removed; a write that set name to `''`; a migration that dropped the field; rename operation that stored a blank.","solutions":["Add `info.name: <non-empty string>` to `workspace.yml`.","When creating programmatically, always pass a non-empty name to `createWorkspaceConfig`.","Validate the name field in any UI rename form before submitting."],"exampleFix":"// before\ninfo:\n  type: workspace\n\n// after\ninfo:\n  name: MyWorkspace\n  type: workspace","handlingStrategy":"validation","validationCode":"function assertWorkspaceName(cfg) {\n  const name = cfg?.info?.name || cfg?.name;\n  if (typeof name !== 'string' || name.trim() === '') {\n    throw new Error('Workspace must have a valid name');\n  }\n}","typeGuard":"function hasValidWorkspaceName(cfg: unknown): boolean {\n  if (typeof cfg !== 'object' || cfg === null) return false;\n  const name = (cfg as any).info?.name ?? (cfg as any).name;\n  return typeof name === 'string' && name.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Require a non-empty name in the rename form before submit.","Default new workspaces to a generated non-empty name."],"tags":["workspace","config","validation","naming"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}