{"record":{"id":"17f56bce681c175b","repo":"micro-editor/micro","slug":"s-you-may-want-to-remove-the-files-in-config-m","errorCode":null,"errorMessage":"%s\nYou may want to remove the files in ~/.config/micro/buffers (these files\nstore the information for the 'saveundo' and 'savecursor' options) if\nthis problem persists.\nThis may be caused by upgrading to version 2.0, and removing the 'buffers'\ndirectory will reset the cursor and undo history and solve the problem.","messagePattern":"(.+?)\nYou may want to remove the files in ~/\\.config/micro/buffers \\(these files\nstore the information for the 'saveundo' and 'savecursor' options\\) if\nthis problem persists\\.\nThis may be caused by upgrading to version 2\\.0, and removing the 'buffers'\ndirectory will reset the cursor and undo history and solve the problem\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/buffer/serialize.go","lineNumber":77,"sourceCode":"\treturn nil\n}\n\n// Unserialize loads the buffer info from config.ConfigDir/buffers\nfunc (b *Buffer) Unserialize() error {\n\t// If either savecursor or saveundo is turned on, we need to load the serialized information\n\t// from ~/.config/micro/buffers\n\tif b.Path == \"\" {\n\t\treturn nil\n\t}\n\tname, _ := util.DetermineEscapePath(filepath.Join(config.ConfigDir, \"buffers\"), b.AbsPath)\n\tfile, err := os.Open(name)\n\tif err == nil {\n\t\tdefer file.Close()\n\t\tvar buffer SerializedBuffer\n\t\tdecoder := gob.NewDecoder(file)\n\t\terr = decoder.Decode(&buffer)\n\t\tif err != nil {\n\t\t\treturn errors.New(err.Error() + \"\\nYou may want to remove the files in ~/.config/micro/buffers (these files\\nstore the information for the 'saveundo' and 'savecursor' options) if\\nthis problem persists.\\nThis may be caused by upgrading to version 2.0, and removing the 'buffers'\\ndirectory will reset the cursor and undo history and solve the problem.\")\n\t\t}\n\t\tif b.Settings[\"savecursor\"].(bool) {\n\t\t\tb.StartCursor = buffer.Cursor\n\t\t}\n\n\t\tif b.Settings[\"saveundo\"].(bool) && buffer.EventHandler != nil {\n\t\t\t// We should only use last time's eventhandler if the file wasn't modified by someone else in the meantime\n\t\t\tif b.ModTime == buffer.ModTime {\n\t\t\t\tb.EventHandler = buffer.EventHandler\n\t\t\t\tb.EventHandler.cursors = b.cursors\n\t\t\t\tb.EventHandler.buf = b.SharedBuffer\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":59,"sourceCodeEnd":94,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/buffer/serialize.go#L59-L94","documentation":"Returned when micro fails to gob-decode a serialized buffer file from $(ConfigDir)/buffers (typically ~/.config/micro/buffers), which stores per-file cursor and undo history for the 'savecursor' and 'saveundo' options. The decode error is appended with recovery advice because these files can be stale or written by an incompatible older format (notably pre-2.0).","triggerScenarios":"Opening a file whose AbsPath has a corresponding entry in ~/.config/micro/buffers that is truncated, corrupted (crash during write), or encoded with a different SerializedBuffer layout (e.g. produced by micro < 2.0). The error fires at decoder.Decode(&buffer) in internal/buffer/serialize.go:77.","commonSituations":"Right after upgrading micro across a version that changed the gob struct, after a hard kill during a buffer write, disk-full events, or syncing the config dir between machines with different micro versions (gob is not a stable cross-version format).","solutions":["Delete the offending files as the message suggests: rm -rf ~/.config/micro/buffers (you lose saved cursors/undo history only).","Delete just the entry for one file: remove the escaped-path file under ~/.config/micro/buffers matching that buffer.","Reproduce which file is bad: open files one by one, or run `ls ~/.config/micro/buffers` and decode with a small gob script if you need the history.","If it recurs after every upgrade, disable \"saveundo\"/\"savecursor\" or clear the buffers dir as part of the upgrade."],"exampleFix":"# before:\nopen myfile.go -> gob decode error + advice text\n\n# after:\nrm -rf ~/.config/micro/buffers\nopen myfile.go -> opens clean","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := buf.Deserialize(); err != nil {\n    if strings.Contains(err.Error(), \"~/.config/micro/buffers\") {\n        // history is optional: log and continue with a fresh EventHandler\n        buf.EventHandler = NewEventHandler(...)\n        err = nil\n    }\n}","preventionTips":["When embedding micro, clear or version-stamp the buffers directory on upgrade.","Treat saveundo/savecursor state as disposable: never rely on it for data integrity.","After every micro version change, wipe ~/.config/micro/buffers proactively if you use those options."],"tags":["serialization","gob","upgrade","corruption","config"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}