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

Imported Skills; skipped MiniMax Code entries

Error message

Imported {} Skills; skipped MiniMax Code entries: {}

What it means

During skill import, entries belonging to MiniMax Code (MCode) that cannot be imported are collected into skipped_mcode. If any were skipped, the function still reports the successfully imported count but returns an Err listing the skipped entries, so callers know the import was partial and which entries need attention. It is a 'partial success reported as error' pattern.

Solutions

  1. Read the skipped list after the semicolon in the message; fix or remove those specific entries and re-import only them.
  2. Check that the import source entries are valid MCode skills (correct manifest/content hash) and supported by the current app type.
  3. If the skipped entries are expected to be unsupported, treat the import as complete for the imported set and log the skipped names instead of retrying.
  4. Separate MCode entries from other app-type entries before import to avoid partial-batch failures.

Example fix

// before: treating the whole import as failed
match import_skills(entries) {
    Err(e) => return e,
    Ok(imported) => return Ok(imported),
}
// after: handle partial import
match import_skills(entries) {
    Err(e) if e.to_string().starts_with("Imported ") => {
        log::warn!("partial import: {e}");
        Ok(())
    }
    other => other,
}
Defensive patterns

Strategy: try-catch

Validate before calling

fn prefilter_mcode(entries: &[Entry], supported: &[AppType]) -> Vec<&Entry> {
    entries.iter().filter(|e| !supported.contains(&e.app_type)).collect()
}

Try / catch

match import_skills(entries) {
    Err(e) if e.to_string().starts_with("Imported ") => {
        let skipped: Vec<&str> = e.to_string().rsplit(": ").next().unwrap_or("").split("; ").collect();
        log::warn!("partially imported, skipped: {skipped:?}");
    }
    Err(e) => return Err(e),
    Ok(v) => Ok(v),
}

Prevention

When it happens

Trigger: Calling the skill import API (e.g. importing from a marketplace/directory batch) where at least one MiniMax Code entry fails validation/deployment and gets pushed to skipped_mcode, while other entries import fine. The Err fires only when skipped_mcode is non-empty.

Common situations: Batch import containing MCode-specific entries in an environment or app-type where they are not supported; entries with invalid structure/hash that fail deployment checks; mixed-source import folders where some entries belong to another app type.

Related errors


AI-assisted analysis of farion1231/cc-switch@06082e189d (2026-09-19). Data as JSON: /api/errors/62a98eea0e7cf10e. Report an issue: GitHub.

Appendix: source

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

                readme_url,
                apps,
                installed_at: chrono::Utc::now().timestamp(),
                content_hash,
                updated_at: 0,
            };

            // 保存到数据库
            db.save_skill(&skill)?;

            imported.push(skill);
        }

        log::info!("成功导入 {} 个 Skills", imported.len());

        if skipped_mcode.is_empty() {
            Ok(imported)
        } else {
            Err(anyhow!(
                "Imported {} Skills; skipped MiniMax Code entries: {}",
                imported.len(),
                skipped_mcode.join("; ")
            ))
        }
    }

    // ========== 文件同步方法 ==========

    /// 创建符号链接(跨平台)
    ///
    /// - Unix: 使用 std::os::unix::fs::symlink
    /// - Windows: 使用 std::os::windows::fs::symlink_dir
    #[cfg(unix)]
    fn create_symlink(src: &Path, dest: &Path) -> Result<()> {
        std::os::unix::fs::symlink(src, dest)
            .with_context(|| format!("创建符号链接失败: {} -> {}", src.display(), dest.display()))
    }

View on GitHub (pinned to 06082e189d)