Skip to content

Cleaning Orphaned Entries

The clean command removes orphaned entries detected by the access command. An orphan is an encrypted symmetric key file (.kanuka) that has no corresponding public key.

Run kanuka secrets clean when:

  • The access command shows entries with “orphan” status
  • You want to clean up after a failed or interrupted operation
  • You’re tidying up the project after manual file changes

First, check if there are any orphaned entries:

Terminal window
kanuka secrets access

If orphans exist, you’ll see output like:

Users with access:
UUID EMAIL STATUS
a1b2c3d4-e5f6-7890-abcd-ef1234567890 [email protected] active
c3d4e5f6-a7b8-9012-cdef-123456789012 unknown orphan
Tip: Run 'kanuka secrets clean' to remove orphaned entries.

To remove orphaned entries:

Terminal window
kanuka secrets clean

This shows the orphaned files and asks for confirmation:

Found 1 orphaned entry:
UUID FILE
c3d4e5f6-a7b8-9012-cdef-123456789012 .kanuka/secrets/c3d4e5f6-...kanuka
This will permanently delete the orphaned files listed above.
These files cannot be recovered.
Do you want to continue? [y/N]:

Type y to confirm and remove the files.

Use the --dry-run flag to see what would be removed without making changes:

Terminal window
kanuka secrets clean --dry-run

This shows:

  • Which files would be deleted
  • No files are actually removed

In automated environments, use --force to skip the confirmation prompt:

Terminal window
kanuka secrets clean --force
Terminal window
# Preview what would be cleaned
kanuka secrets clean --dry-run
# Clean with confirmation prompt
kanuka secrets clean
# Clean without confirmation (for automation)
kanuka secrets clean --force

Orphaned entries can occur when:

CauseDescription
Manual deletionSomeone deleted a public key file directly
Interrupted revokeA revoke operation failed after deleting the public key
Partial restoreA backup was restored that didn’t include public keys
File corruptionFiles were lost or corrupted

After cleaning:

  1. Commit the changes - The orphaned files have been removed
  2. Push to remote - So the cleanup is reflected for the team
Terminal window
git add .kanuka/
git commit -m "Clean up orphaned entries"
git push