farion1231/cc-switch · error · anyhow::Error

Pi 中已存在同名但内容不同的 Skill,拒绝覆盖或删除: {directory}

Error message

Pi 中已存在同名但内容不同的 Skill,拒绝覆盖或删除: {directory}

What it means

inspect_pi_skill_destination found the destination path inside Pi's skills directory already occupied, and the occupant is provably not ours: it is not a symlink resolving to the SSOT source, and it is not a byte-identical copy (deployment hash differs). The service refuses to overwrite or delete content it cannot verify it owns — a data-loss guard for the Pi app directory.

Source

Thrown at src-tauri/src/services/skill.rs:2163

            ) {
                return Ok(Some(PiSkillDeployment::Symlink {
                    expected_target: resolved,
                }));
            }
        } else if destination.is_dir() {
            if let (Ok(destination_hash), Ok(source_hash)) = (
                Self::compute_pi_deployment_hash(destination),
                Self::compute_pi_deployment_hash(source),
            ) {
                if destination_hash == source_hash {
                    return Ok(Some(PiSkillDeployment::Copy {
                        expected_hash: destination_hash,
                    }));
                }
            }
        }

        Err(anyhow!(
            "Pi 中已存在同名但内容不同的 Skill,拒绝覆盖或删除: {directory}"
        ))
    }

    fn remove_verified_pi_destination(
        source: &Path,
        destination: &Path,
        directory: &str,
    ) -> Result<()> {
        match Self::inspect_pi_skill_destination(source, destination, directory)? {
            Some(_) => Self::remove_path(destination),
            None => Ok(()),
        }
    }

    fn refresh_pi_skill_destination(
        source: &Path,
        destination: &Path,

View on GitHub (pinned to 0b5da51016)

Solutions

  1. Open Pi's skills directory, back up the conflicting same-named folder, then remove or rename it, and retry the install/sync
  2. If the Pi-side content is the one you want to keep, copy it back into the SSOT directory first so hashes align
  3. Avoid hand-editing skills inside Pi's directory; edit the SSOT copy and re-sync
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await invoke('install_skill_unified', payload);
} catch (e) {
  const msg = String(e);
  if (msg.includes('Pi 中已存在同名但内容不同的 Skill')) {
    notify('A different skill with this name exists in Pi — back it up and remove it from Pi\'s skills dir, then retry');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: User manually installed a same-named skill into Pi's skills folder; Pi (or another tool) modified the deployed copy so its hash no longer matches the SSOT source; switching sync methods (copy vs symlink) with diverged content; leftover Pi deployment from a removed SSOT skill.

Common situations: Power users managing Pi's skills directory by hand; Pi upgrading/rewriting skill files in place; machines migrated with only the Pi directory copied.

Related errors


AI-assisted analysis of farion1231/cc-switch@0b5da51016 (2026-08-20). Data as JSON: /api/errors/a064201365f3418f. Report an issue: GitHub.