usebruno/bruno · error · Error

Invalid workspace: not a bruno workspace

Error message

Invalid workspace: not a bruno workspace

What it means

`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.

Source

Thrown at packages/bruno-electron/src/utils/workspace-config.js:303

  return yamlLines.join('\n');
};

const writeWorkspaceConfig = async (workspacePath, config) => {
  return withLock(getWorkspaceLockKey(workspacePath), async () => {
    const yamlContent = generateYamlContent(config);
    await writeWorkspaceFileAtomic(workspacePath, yamlContent);
  });
};

const validateWorkspaceConfig = (config) => {
  if (!config || typeof config !== 'object') {
    throw new Error('Workspace configuration must be an object');
  }

  const type = config.info?.type || config.type;
  if (type !== WORKSPACE_TYPE) {
    throw new Error('Invalid workspace: not a bruno workspace');
  }

  const name = config.info?.name || config.name;
  if (!name || typeof name !== 'string') {
    throw new Error('Workspace must have a valid name');
  }

  return true;
};

const updateWorkspaceName = async (workspacePath, newName) => {
  return withLock(getWorkspaceLockKey(workspacePath), async () => {
    const config = readWorkspaceConfig(workspacePath);
    config.name = newName;
    if (config.info) {
      config.info.name = newName;
    }
    const yamlContent = generateYamlContent(config);

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Confirm the file is a workspace manifest and that `info.type: workspace` is present.
  2. If it is actually a collection, use the collection APIs instead of the workspace APIs.
  3. Set `info.type: workspace` (or top-level `type: workspace`) when generating.

Example fix

// before
info:
  name: MyThing
  type: collection

// after
info:
  name: MyWorkspace
  type: workspace
Defensive patterns

Strategy: validation

Validate before calling

function assertWorkspaceType(cfg) {
  const type = cfg?.info?.type || cfg?.type;
  if (type !== 'workspace') {
    throw new Error(`Expected a workspace config, got type=${type}`);
  }
}

Type guard

function isWorkspaceManifest(cfg: unknown): boolean {
  if (typeof cfg !== 'object' || cfg === null) return false;
  const t = (cfg as any).info?.type ?? (cfg as any).type;
  return t === 'workspace';
}

Prevention

When it happens

Trigger: Passing a parsed config whose `info.type`/`type` is `collection`, missing, or any value other than `'workspace'` to `validateWorkspaceConfig`.

Common situations: 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.

Related errors


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/362c2812b37debf5. Report an issue: GitHub.