jely2002/youtube-dl-gui · error · Error

Failed to retrieve stronghold status

Error message

Failed to retrieve stronghold status: ${strongholdStatus.initError}

What it means

loadStatus queries the Rust backend ('stronghold_status' / 'stronghold_keys') for the stronghold (secure vault) state. When the backend reports an initError, the store records it on status, marks the vault locked, and throws 'Failed to retrieve stronghold status: ${initError}' so callers know status is unreliable.

Solutions

  1. Read status.value.initError for the concrete backend message and fix that underlying cause first.
  2. Re-initialize the vault by calling initialize() (stronghold_init) or delete/reset the corrupted snapshot so it is recreated.
  3. Verify the snapshot file location and permissions match what the backend expects.
  4. Wrap loadStatus in try/catch and route the user to a vault setup/recovery screen instead of letting it bubble.

Example fix

// before
const status = await strongholdStore.loadStatus();
// after
let status;
try {
  status = await strongholdStore.loadStatus();
} catch (e) {
  status = await strongholdStore.initialize(); // or show recovery UI
}
Defensive patterns

Strategy: try-catch

Validate before calling

const raw = await invoke<StrongholdStatusPayload>('stronghold_status');
if (raw.initError) {
  throw new Error(`Stronghold not ready: ${raw.initError}`);
}

Type guard

const isStrongholdHealthy = (s: StrongholdStatus): boolean => !s.initError;

Try / catch

try {
  await strongholdStore.loadStatus();
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Failed to retrieve stronghold status')) {
    router.push({ name: 'vault-recovery' });
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: invoke of the stronghold status command returns a payload with initError set — the stronghold snapshot file is corrupt/unreadable, the password hash mismatch, or the backend failed to initialize the vault at startup.

Common situations: Corrupted or manually edited stronghold snapshot; snapshot written by an incompatible app/backend version; missing or wrong file permissions on the vault directory; first run after a failed initialization.

Related errors


AI-assisted analysis of jely2002/youtube-dl-gui@c402ee39c0 (2026-09-12). Data as JSON: /api/errors/29dbe6320db07f9e. Report an issue: GitHub.

Appendix: source

Thrown at src/stores/stronghold.ts:47

  headers: string | null;
}

export const useStrongholdStore = defineStore('stronghold', () => {
  const status = ref<StrongholdStatus>(defaultStrongholdStatus);
  const availableKeys = ref<number[][]>([]);

  async function loadStatus(): Promise<StrongholdStatus> {
    const strongholdStatus: StrongholdInitPayload = await invoke('stronghold_status');
    if (strongholdStatus.unlocked && !strongholdStatus.initError) {
      status.value.unlocked = true;

      availableKeys.value = await invoke('stronghold_keys');
    } else if (!strongholdStatus.unlocked && !strongholdStatus.initError) {
      status.value.unlocked = false;
    } else {
      status.value.unlocked = false;
      status.value.initError = strongholdStatus.initError ?? 'Unknown error.';
      throw new Error(`Failed to retrieve stronghold status: ${strongholdStatus.initError}`);
    }
    return status.value;
  }

  async function initialize(): Promise<StrongholdStatus> {
    const initStatus: StrongholdInitPayload = await invoke('stronghold_init');
    if (initStatus.initError) {
      status.value.initError = initStatus.initError;
      status.value.unlocked = false;
      throw new Error(`Failed to initialize stronghold: ${initStatus.initError}`);
    }
    status.value.unlocked = initStatus.unlocked;

    availableKeys.value = await invoke('stronghold_keys');
    return status.value;
  }

  async function getValues(): Promise<StrongholdFields> {

View on GitHub (pinned to c402ee39c0)