{"record":{"id":"e025deb5aded29a6","repo":"micro-editor/micro","slug":"aborted","errorCode":null,"errorMessage":"Aborted","messagePattern":"Aborted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/micro/micro.go","lineNumber":285,"sourceCode":"\t\tinput, err := os.ReadFile(backup)\n\t\tif err == nil {\n\t\t\tt := info.ModTime()\n\t\t\tmsg := fmt.Sprintf(buffer.BackupMsg, target, t.Format(\"Mon Jan _2 at 15:04, 2006\"), backup)\n\t\t\tchoice := screen.TermPrompt(msg, []string{\"r\", \"i\", \"a\", \"recover\", \"ignore\", \"abort\"}, true)\n\n\t\t\tif choice%3 == 0 {\n\t\t\t\t// recover\n\t\t\t\terr := os.WriteFile(target, input, util.FileMode)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn os.Remove(backup)\n\t\t\t} else if choice%3 == 1 {\n\t\t\t\t// delete\n\t\t\t\treturn os.Remove(backup)\n\t\t\t} else if choice%3 == 2 {\n\t\t\t\t// abort\n\t\t\t\treturn errors.New(\"Aborted\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc exit(rc int) {\n\tfor _, b := range buffer.OpenBuffers {\n\t\tif !b.Modified() {\n\t\t\tb.Fini()\n\t\t}\n\t}\n\n\tif screen.Screen != nil {\n\t\tscreen.Screen.Fini()\n\t}\n\n\tos.Exit(rc)","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/cmd/micro/micro.go#L267-L303","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Relaunch micro and pick 'r' (recover) or 'i' (ignore) instead of 'a' at the backup prompt","Delete the stale backup manually: rm ~/.config/micro/settings.json.bak (and/or bindings.json.bak), then start micro","If micro was ever run as root, fix ownership of the whole config dir: sudo chown -R $USER: ~/.config/micro","If you scripted/automated micro, ensure stdin is a terminal or pre-clean backups before launch so the prompt never appears"],"exampleFix":"// before: startup aborts after answering 'a' to the backup prompt\nmicro\n# prompt: \"Backup of settings.json found... (r)ecover, (i)gnore, (a)bort\" -> a\n# -> micro exits with: Aborted\n\n// after: recover the backup at the prompt (r), or pre-delete it\nrm ~/.config/micro/settings.json.bak && micro","handlingStrategy":"try-catch","validationCode":"// Before scripting micro, remove stale config backups so the prompt cannot abort startup\nbackupSuffix := \".bak\" // util.BackupSuffix\nfor _, name := range []string{\"settings.json\", \"bindings.json\"} {\n    p := filepath.Join(configDir, name+backupSuffix)\n    if _, err := os.Stat(p); err == nil {\n        _ = os.Remove(p) // or surface it to the operator\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := checkBackup(\"settings.json\"); err != nil {\n    if err.Error() == \"Aborted\" {\n        // user chose abort: honor intent, exit cleanly with a message, do not retry\n        fmt.Fprintln(os.Stderr, \"startup aborted by user:\", err)\n        os.Exit(1)\n    }\n    return err // real I/O error (recover/remove failed)\n}","preventionTips":["Don't SIGKILL micro during settings changes; close it normally so backups never linger","Never run micro as root against a user config dir; check ownership after any sudo use","In automation, pre-clean *.bak files under the config dir before launch"],"tags":["startup","backup","recovery","user-abort","config"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}