libnyanpasu/clash-nyanpasu · error
partial typed config migration state: existing [{}], missing
Error message
partial typed config migration state: existing [{}], missing [{}]; restore or remove the typed config files before retrying What it means
This error is thrown by `partial_typed_file_state` during typed config migration when the on-disk state is inconsistent: some typed config files already exist while others expected for the migration are missing. The migration refuses to run in this half-applied state to avoid overwriting or duplicating partially migrated data. The operator must either restore the missing files or remove the existing ones so the migration can start from a clean, consistent state.
Source
Thrown at backend/tauri/src/core/migration/modules/typed_config.rs:299
fn push_file_state(
existing: &mut Vec<&'static str>,
missing: &mut Vec<&'static str>,
exists: bool,
name: &'static str,
) {
if exists {
existing.push(name);
} else {
missing.push(name);
}
}
fn partial_typed_file_state(
existing: Vec<&'static str>,
missing: Vec<&'static str>,
) -> anyhow::Result<TypedFileState> {
bail!(
"partial typed config migration state: existing [{}], missing [{}]; \
restore or remove the typed config files before retrying",
existing.join(", "),
missing.join(", ")
);
}
fn validate_existing_typed_files(ctx: &Ctx) -> anyhow::Result<()> {
validate_existing_application_and_session(ctx)?;
read_yaml::<nyanpasu_config::clash::config::ClashConfig>(&ctx.clash_config_path())
.context("failed to validate existing clash config")?;
Ok(())
}
fn validate_existing_application_and_session(ctx: &Ctx) -> anyhow::Result<()> {
read_yaml::<nyanpasu_config::application::NyanpasuAppConfig>(&ctx.application_config_path())
.context("failed to validate existing application config")?;
read_yaml::<nyanpasu_config::state::PersistentState>(&ctx.session_state_path())View on GitHub (pinned to f7dbce2997)
Solutions
- Inspect the two lists in the error message: back up and remove the files listed under 'existing' to retry the migration from scratch.
- Alternatively, restore/recreate the files listed under 'missing' (e.g. from backup or a previous installation) to complete the set so migration sees a consistent state.
- After fixing, re-run the migration; if it keeps failing, wipe the typed config files entirely and let the migration regenerate them.
Example fix
// before: partial state on disk ~/.config/nyanpasu/typed/app.yaml (exists) ~/.config/nyanpasu/typed/verge.yaml (missing) // after option 1: remove leftovers to start clean rm ~/.config/nyanpasu/typed/app.yaml // after option 2: restore the missing file from backup cp ~/backup/nyanpasu/typed/verge.yaml ~/.config/nyanpasu/typed/verge.yaml
Defensive patterns
Strategy: validation
Validate before calling
// Check typed config dir consistency before triggering migration
fn typed_state_is_consistent(expected: &[&str], dir: &Path) -> bool {
let present: Vec<_> = expected.iter().filter(|f| dir.join(f).exists()).collect();
present.is_empty() || present.len() == expected.len()
}
if !typed_state_is_consistent(&["app.yaml", "verge.yaml"], &typed_dir) {
eprintln!("partial typed config state; restore or remove files before migrating");
} Try / catch
match migration_result {
Err(e) if e.to_string().contains("partial typed config migration state") => {
// surface existing/missing lists to the user for manual cleanup
}
other => other?,
} Prevention
- Make migration file writes atomic: write to temp files and rename only after all files succeed
- Keep a backup of the config directory before running migrations
- Never hand-delete individual typed config files; use the app's reset/cleanup function
- Log each file written during migration so partial states are diagnosable
When it happens
Trigger: Calling `typed_file_state` (which calls `partial_typed_file_state`) when the set of existing typed config files is neither empty nor complete — e.g. only some of the typed config files (existing list) are present on disk while others (missing list) are absent.
Common situations: A previous migration run was interrupted (crash, power loss, kill) after writing some typed config files; a user manually deleted one of several typed config files; a version downgrade removed some files while others remained; syncing/restore tools partially restored the config directory.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- cannot repair typed clash config before split_legacy_config
- unrecognized typed config migration state: existing {} is ne
- unsupported migration store schema version {}
- failed to parse config: {e}
- failed to serialize config: {e}
AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08).
Data as JSON: /api/errors/48e51bbb22ce8ce4.
Report an issue: GitHub.