micro-editor/micro · error

Aborted

Error message

Aborted

What it means

Returned by checkBackup() in cmd/micro/micro.go when the user answers 'abort' to the crash-recovery prompt. At startup micro checks for a .bak backup of settings.json and bindings.json in the config directory (created when a previous run died mid-write); the prompt offers recover/ignore/abort and choice%3==2 maps to abort. Choosing abort deliberately stops startup with this error. It is a user-intent signal, not a system failure.

Source

Thrown at cmd/micro/micro.go:285

		input, err := os.ReadFile(backup)
		if err == nil {
			t := info.ModTime()
			msg := fmt.Sprintf(buffer.BackupMsg, target, t.Format("Mon Jan _2 at 15:04, 2006"), backup)
			choice := screen.TermPrompt(msg, []string{"r", "i", "a", "recover", "ignore", "abort"}, true)

			if choice%3 == 0 {
				// recover
				err := os.WriteFile(target, input, util.FileMode)
				if err != nil {
					return err
				}
				return os.Remove(backup)
			} else if choice%3 == 1 {
				// delete
				return os.Remove(backup)
			} else if choice%3 == 2 {
				// abort
				return errors.New("Aborted")
			}
		}
	}
	return nil
}

func exit(rc int) {
	for _, b := range buffer.OpenBuffers {
		if !b.Modified() {
			b.Fini()
		}
	}

	if screen.Screen != nil {
		screen.Screen.Fini()
	}

	os.Exit(rc)

View on GitHub (pinned to 1c8b82b32e)

Solutions

  1. Relaunch micro and pick 'r' (recover) or 'i' (ignore) instead of 'a' at the backup prompt
  2. Delete the stale backup manually: rm ~/.config/micro/settings.json.bak (and/or bindings.json.bak), then start micro
  3. If micro was ever run as root, fix ownership of the whole config dir: sudo chown -R $USER: ~/.config/micro
  4. If you scripted/automated micro, ensure stdin is a terminal or pre-clean backups before launch so the prompt never appears

Example fix

// before: startup aborts after answering 'a' to the backup prompt
micro
# prompt: "Backup of settings.json found... (r)ecover, (i)gnore, (a)bort" -> a
# -> micro exits with: Aborted

// after: recover the backup at the prompt (r), or pre-delete it
rm ~/.config/micro/settings.json.bak && micro
Defensive patterns

Strategy: try-catch

Validate before calling

// Before scripting micro, remove stale config backups so the prompt cannot abort startup
backupSuffix := ".bak" // util.BackupSuffix
for _, name := range []string{"settings.json", "bindings.json"} {
    p := filepath.Join(configDir, name+backupSuffix)
    if _, err := os.Stat(p); err == nil {
        _ = os.Remove(p) // or surface it to the operator
    }
}

Try / catch

if err := checkBackup("settings.json"); err != nil {
    if err.Error() == "Aborted" {
        // user chose abort: honor intent, exit cleanly with a message, do not retry
        fmt.Fprintln(os.Stderr, "startup aborted by user:", err)
        os.Exit(1)
    }
    return err // real I/O error (recover/remove failed)
}

Prevention

When it happens

Trigger: A previous micro session crashed or was SIGKILLed while writing settings.json or bindings.json, leaving a backup file (config.ConfigDir/<name> + util.BackupSuffix). At the next launch, the TermPrompt offers 'r/i/a' (recover, ignore, abort); the user selects 'a' or 'abort', so checkBackup returns errors.New("Aborted") and micro exits without loading config.

Common situations: Editor killed by OOM killer, terminal closed, or power loss during settings save; users on multi-user machines where micro ran as root once (root-owned backup in $HOME/.config/micro); CI/non-interactive runs where TermPrompt cannot be answered and defaults resolve to abort.

Related errors


AI-assisted analysis of micro-editor/micro@1c8b82b32e (2026-08-15). Data as JSON: /api/errors/e025deb5aded29a6. Report an issue: GitHub.