{"record":{"id":"406faa4cc1229f8c","repo":"ipfs/kubo","slug":"cp-cannot-flush-the-source-s-file-s-parent-folder","errorCode":null,"errorMessage":"cp: cannot flush the source's file's parent folder %s: %s","messagePattern":"cp: cannot flush the source's file's parent folder (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/files.go","lineNumber":959,"sourceCode":"\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\nconst (\n\tfilesCreateOptionName    = \"create\"\n\tfilesParentsOptionName   = \"parents\"\n\tfilesTruncateOptionName  = \"truncate\"\n\tfilesRawLeavesOptionName = \"raw-leaves\"\n\tfilesFlushOptionName     = \"flush\"","sourceCodeStart":941,"sourceCodeEnd":977,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/files.go#L941-L977","documentation":"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.","triggerScenarios":"Thrown at core/commands/files.go:959 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the underlying flush error surfaced in the message (datastore I/O, disk space), then re-run `ipfs files cp`/`mv`.","Run `ipfs files flush /` to force a full-root flush so MFS state is persisted.","Verify the source path's parent still exists if concurrent modifications are running."],"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"}