glzr-io/glazewm · error

The workspace " " already exists

Error message

The workspace "{}" already exists

What it means

`update_workspace_config` validates a workspace rename before applying it. If the requested new name matches another existing workspace, the rename would create a duplicate, so it bails with the conflicting name in the message.

Solutions

  1. Pick a unique workspace name before renaming
  2. List existing workspaces and check the target name is free first
  3. Handle the error in IPC clients and surface a clear message to the user

Example fix

// before
update_workspace_config(&state, &workspace, WorkspaceConfig { name: Some("1".into()), ..cfg })?;
// after
if state.workspace_by_name("1").is_none() {
  update_workspace_config(&state, &workspace, WorkspaceConfig { name: Some("1".into()), ..cfg })?;
}
Defensive patterns

Strategy: validation

Validate before calling

if let Some(_) = state.workspace_by_name(&new_name) {
  eprintln!("workspace name '{new_name}' is already in use");
} else {
  update_workspace_config(&state, &workspace, new_config)?;
}

Try / catch

match update_workspace_config(&state, &workspace, new_config) {
  Err(e) if e.to_string().contains("already exists") => {
    eprintln!("choose a different workspace name");
  }
  r => r?,
}

Prevention

When it happens

Trigger: Calling `update_workspace_config` (directly or via a workspace-focused IPC command like `wm command focused_workspace ...` or config reload) with `new_config.name` equal to the name of a different workspace.

Common situations: Duplicated workspace names in the user config after editing, or IPC automation renaming a workspace to a name already in use.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of glzr-io/glazewm@5709ad0a3c (2026-09-08). Data as JSON: /api/errors/7d0d225f02df0321. Report an issue: GitHub.

Appendix: source

Thrown at packages/wm/src/commands/workspace/update_workspace_config.rs:22

use super::sort_workspaces;
use crate::{
  models::Workspace, traits::CommonGetters, user_config::UserConfig,
  wm_state::WmState,
};

pub fn update_workspace_config(
  workspace: &Workspace,
  state: &WmState,
  config: &UserConfig,
  new_config: &InvokeUpdateWorkspaceConfig,
) -> anyhow::Result<()> {
  let current_config = workspace.config();

  // Validate the workspace name change.
  if let Some(new_name) = &new_config.name {
    if new_name != &current_config.name {
      if let Some(_other_workspace) = state.workspace_by_name(new_name) {
        anyhow::bail!("The workspace \"{}\" already exists", new_name);
      }
    }
  }

  // Update the config with the incoming values.
  let updated_config = WorkspaceConfig {
    name: new_config
      .name
      .clone()
      .unwrap_or(current_config.name.clone()),
    display_name: new_config
      .display_name
      .clone()
      .or(current_config.display_name.clone()),
    bind_to_monitor: new_config
      .bind_to_monitor
      .or(current_config.bind_to_monitor),
    keep_alive: new_config.keep_alive.unwrap_or(current_config.keep_alive),

View on GitHub (pinned to 5709ad0a3c)