ipfs/kubo · error

cp: cannot flush the source's file's parent folder %s: %s

Error message

cp: cannot flush the source's file's parent folder %s: %s

What it means

Same post-move flush sequence as the destination-parent error, but here the source's parent directory failed to flush (only attempted when src and dst are in different folders). The move completed; persisting the source parent's updated directory listing to the root failed.

Source

Thrown at core/commands/files.go:959

			return err
		}

		err = mfs.Mv(nd.FilesRoot, src, dst)
		if err != nil {
			return err
		}
		if flush {
			parentSrc := gopath.Dir(src)
			parentDst := gopath.Dir(dst)
			// Flush parent to clear directory cache and free memory.
			if _, err = mfs.FlushPath(req.Context, nd.FilesRoot, parentDst); err != nil {
				return fmt.Errorf("cp: cannot flush the destination file's parent folder %s: %s", dst, err)
			}

			// Avoid re-flushing when moving within the same folder.
			if parentSrc != parentDst {
				if _, err = mfs.FlushPath(req.Context, nd.FilesRoot, parentSrc); err != nil {
					return fmt.Errorf("cp: cannot flush the source's file's parent folder %s: %s", dst, err)
				}
			}

			if _, err = mfs.FlushPath(req.Context, nd.FilesRoot, "/"); err != nil {
				return err
			}
		}

		return nil
	},
}

const (
	filesCreateOptionName    = "create"
	filesParentsOptionName   = "parents"
	filesTruncateOptionName  = "truncate"
	filesRawLeavesOptionName = "raw-leaves"
	filesFlushOptionName     = "flush"

View on GitHub (pinned to 329838acdf)

Solutions

  1. Fix the underlying flush error surfaced in the message (datastore I/O, disk space), then re-run `ipfs files cp`/`mv`.
  2. Run `ipfs files flush /` to force a full-root flush so MFS state is persisted.
  3. Verify the source path's parent still exists if concurrent modifications are running.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/commands/files.go:959 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/406faa4cc1229f8c. Report an issue: GitHub.