micro-editor/micro · warning

%s You may want to remove the files in ~/.config/micro/buffe

Error message

%s
You may want to remove the files in ~/.config/micro/buffers (these files
store the information for the 'saveundo' and 'savecursor' options) if
this problem persists.
This may be caused by upgrading to version 2.0, and removing the 'buffers'
directory will reset the cursor and undo history and solve the problem.

What it means

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).

Source

Thrown at internal/buffer/serialize.go:77

	return nil
}

// Unserialize loads the buffer info from config.ConfigDir/buffers
func (b *Buffer) Unserialize() error {
	// If either savecursor or saveundo is turned on, we need to load the serialized information
	// from ~/.config/micro/buffers
	if b.Path == "" {
		return nil
	}
	name, _ := util.DetermineEscapePath(filepath.Join(config.ConfigDir, "buffers"), b.AbsPath)
	file, err := os.Open(name)
	if err == nil {
		defer file.Close()
		var buffer SerializedBuffer
		decoder := gob.NewDecoder(file)
		err = decoder.Decode(&buffer)
		if err != nil {
			return 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.")
		}
		if b.Settings["savecursor"].(bool) {
			b.StartCursor = buffer.Cursor
		}

		if b.Settings["saveundo"].(bool) && buffer.EventHandler != nil {
			// We should only use last time's eventhandler if the file wasn't modified by someone else in the meantime
			if b.ModTime == buffer.ModTime {
				b.EventHandler = buffer.EventHandler
				b.EventHandler.cursors = b.cursors
				b.EventHandler.buf = b.SharedBuffer
			}
		}
	}
	return nil
}

View on GitHub (pinned to 1c8b82b32e)

Solutions

  1. Delete the offending files as the message suggests: rm -rf ~/.config/micro/buffers (you lose saved cursors/undo history only).
  2. Delete just the entry for one file: remove the escaped-path file under ~/.config/micro/buffers matching that buffer.
  3. 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.
  4. If it recurs after every upgrade, disable "saveundo"/"savecursor" or clear the buffers dir as part of the upgrade.

Example fix

# before:
open myfile.go -> gob decode error + advice text

# after:
rm -rf ~/.config/micro/buffers
open myfile.go -> opens clean
Defensive patterns

Strategy: fallback

Try / catch

if err := buf.Deserialize(); err != nil {
    if strings.Contains(err.Error(), "~/.config/micro/buffers") {
        // history is optional: log and continue with a fresh EventHandler
        buf.EventHandler = NewEventHandler(...)
        err = nil
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


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