{"record":{"id":"c02248ffeb262423","repo":"ipfs/kubo","slug":"cp-cannot-flush-the-destination-file-s-parent-fol","errorCode":null,"errorMessage":"cp: cannot flush the destination file's parent folder %s: %s","messagePattern":"cp: cannot flush the destination file's parent folder (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/files.go","lineNumber":953,"sourceCode":"\t\tsrc, err := checkPath(req.Arguments[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdst, err := checkPath(req.Arguments[1])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = mfs.Mv(nd.FilesRoot, src, dst)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif flush {\n\t\t\tparentSrc := gopath.Dir(src)\n\t\t\tparentDst := gopath.Dir(dst)\n\t\t\t// Flush parent to clear directory cache and free memory.\n\t\t\tif _, err = mfs.FlushPath(req.Context, nd.FilesRoot, parentDst); err != nil {\n\t\t\t\treturn fmt.Errorf(\"cp: cannot flush the destination file's parent folder %s: %s\", dst, err)\n\t\t\t}\n\n\t\t\t// Avoid re-flushing when moving within the same folder.\n\t\t\tif parentSrc != parentDst {\n\t\t\t\tif _, err = mfs.FlushPath(req.Context, nd.FilesRoot, parentSrc); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"cp: cannot flush the source's file's parent folder %s: %s\", dst, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif _, err = mfs.FlushPath(req.Context, nd.FilesRoot, \"/\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t},\n}\n","sourceCodeStart":935,"sourceCodeEnd":971,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/files.go#L935-L971","documentation":"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.","triggerScenarios":"Thrown at core/commands/files.go:953 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped inner error (disk full, datastore failure, invalid path) and fix the underlying cause, then retry the command.","Run `ipfs files flush /` to flush the MFS root manually so the moved state is persisted.","If it recurs, check the node's datastore health and free disk space under IPFS_PATH."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}