ipfs/kubo · error

can't remove some files

Error message

can't remove some files

What it means

Aggregate result of `ipfs files rm` when at least one of the requested paths failed (invalid path or removal error). Each individual error was already emitted to the response stream; this final error signals the command as a whole did not fully succeed, while some paths may have been removed.

Source

Thrown at core/commands/files.go:1425

		for _, arg := range req.Arguments {
			path, err := checkPath(arg)
			if err != nil {
				errs = append(errs, fmt.Errorf("%s is not a valid path: %w", arg, err))
				continue
			}

			if err := removePath(nd.FilesRoot, path, force, dashr); err != nil {
				errs = append(errs, fmt.Errorf("%s: %w", path, err))
			}
		}
		if len(errs) > 0 {
			for _, err = range errs {
				e := res.Emit(err.Error())
				if e != nil {
					return e
				}
			}
			return fmt.Errorf("can't remove some files")
		}
		return nil
	},
}

func removePath(filesRoot *mfs.Root, path string, force bool, dashr bool) error {
	if path == "/" {
		return fmt.Errorf("cannot delete root")
	}

	// 'rm a/b/c/' will fail unless we trim the slash at the end
	if path[len(path)-1] == '/' {
		path = path[:len(path)-1]
	}

	dir, name := gopath.Split(path)

	pdir, err := getParentDir(filesRoot, dir)

View on GitHub (pinned to 329838acdf)

Solutions

  1. Read the per-path errors emitted before this message to see which arguments failed.
  2. Re-run `ipfs files rm` for only the paths that were not removed; removals are idempotent, and already-removed paths with --force report no error.
Defensive patterns

Strategy: try-catch

When it happens

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