ipfs/kubo · error

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

Error message

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

What it means

The `ipfs files cp`/`mv` handler wraps a failure of mfs.FlushPath on the destination's parent directory after a successful mfs.Mv. It means the move itself succeeded but flushing the destination parent (to clear the MFS directory cache and free memory) failed, so the on-disk root may lag the in-memory MFS state until a later flush.

Source

Thrown at core/commands/files.go:953

		src, err := checkPath(req.Arguments[0])
		if err != nil {
			return err
		}
		dst, err := checkPath(req.Arguments[1])
		if err != nil {
			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
	},
}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Inspect the wrapped inner error (disk full, datastore failure, invalid path) and fix the underlying cause, then retry the command.
  2. Run `ipfs files flush /` to flush the MFS root manually so the moved state is persisted.
  3. If it recurs, check the node's datastore health and free disk space under IPFS_PATH.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/commands/files.go:953 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/c02248ffeb262423. Report an issue: GitHub.