Skip to content

[BUG] [v0.0.7] cortex uninstall --backup writes to ~/.cortex-backup via dirs::home_dir(), ignoring CORTEX_HOME #52799

@fremicout03

Description

@fremicout03

Project

cortex

Description

create_backup in uninstall_cmd.rs sets backup_dir to dirs::home_dir()?.join(".cortex-backup") (with fallbacks). It does not nest backups under CORTEX_HOME or cortex_common::get_cortex_home().

Users who relocate all Cortex state with CORTEX_HOME may expect uninstall backups to live beside that tree; instead, backups always go to the OS user home .cortex-backup, splitting artifacts across locations.

Build / context:

  • Build: Current cortex-cli.
  • Surface: cortex uninstall --backup.
  • File: src/cortex-cli/src/uninstall_cmd.rs (create_backup, ~lines 711–720).

Error Message

Debug Logs

System Information

OS:Windows11

Screenshots

https://github.com/fremicout04/blog/blob/main/Screenshot%202026-04-09%20172554.png

Steps to Reproduce

  1. Set CORTEX_HOME to a dedicated directory with Cortex data.
  2. Run cortex uninstall --backup --dry-run (or full flow in a test VM) and note printed Backup location.
  3. Observe path under %USERPROFILE% / $HOME, not under CORTEX_HOME.

Expected Behavior

  • Use get_cortex_home().join(".cortex-backup") (or CORTEX_HOME/../cortex-backup policy documented in --help).

Actual Behavior

  • Fixed <user home>/.cortex-backup.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions