lima-vm/lima · warning

instance %#q directory %#q exists but its %#q could not be r

Error message

instance %#q directory %#q exists but its %#q could not be read; it was NOT deleted, in case it is currently being cloned into. If no `limactl` operation is using it, remove it manually

What it means

During `limactl delete`, the instance directory exists but its lima.yaml could not be read, so Lima refuses to delete it. The directory may be mid-clone (another limactl operation is creating the instance), and deleting it would corrupt the clone. The error intentionally leaves data in place and tells the user to remove it manually.

Source

Thrown at cmd/limactl/delete.go:85

	}
	if err := reconcile.Reconcile(ctx, ""); err != nil {
		errs = append(errs, err)
	}
	return errors.Join(errs...)
}

func warnAboutMissingInstance(instName string) error {
	instDir, err := dirnames.InstanceDir(instName)
	if err != nil {
		return err
	}
	if _, statErr := os.Stat(instDir); errors.Is(statErr, os.ErrNotExist) {
		logrus.Warnf("Ignoring non-existent instance %#q", instName)
		return nil
	} else if statErr != nil {
		return statErr
	}
	return fmt.Errorf("instance %#q directory %#q exists but its %#q could not be read; "+
		"it was NOT deleted, in case it is currently being cloned into. "+
		"If no `limactl` operation is using it, remove it manually",
		instName, instDir, filenames.LimaYAML)
}

func deleteBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
	return bashCompleteInstanceNames(cmd)
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Wait for any concurrent `limactl clone`/`start` to finish, then retry delete
  2. Confirm no limactl process is using the directory (ps aux | grep limactl)
  3. If truly orphaned, remove manually: rm -rf ~/.lima/instances/<name>
  4. Restore lima.yaml from backup if the instance should be kept

Example fix

// before
$ limactl delete brokenvm
// instance "brokenvm" directory ... exists but its "lima.yaml" could not be read ...
// after
$ ps aux | grep limactl        # ensure nothing is cloning into it
$ rm -rf ~/.lima/instances/brokenvm
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs')
const limaYaml = `${instanceDir}/lima.yaml`
if (fs.existsSync(instanceDir) && !fs.existsSync(limaYaml)) {
  console.warn('Instance dir unreadable/incomplete; ensure no clone is in progress')
}

Type guard

function isDeletableInstance(dir: string): boolean {
  return require('fs').existsSync(`${dir}/lima.yaml`)
}

Try / catch

try {
  await deleteInstance(name)
} catch (err) {
  if (/could not be read/.test(err.message)) {
    console.warn('Orphan dir; remove manually after confirming no limactl process:', err.message)
  } else throw err
}

Prevention

When it happens

Trigger: deleteAction encountered an instance whose directory exists but store.Inspect failed to read lima.yaml, so warnAboutMissingInstance reports it. Happens when a `limactl clone`/`start` is concurrently writing the directory, or lima.yaml was deleted/corrupted.

Common situations: Interrupted clone/rename leaving a half-written instance dir; concurrent limactl operations on the same store; manual edits/deletions inside ~/.lima/instances/<name>; disk errors truncating lima.yaml.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/f04e7939205634e1. Report an issue: GitHub.