ipfs/kubo · error

%s: %w

Error message

%s: %w

What it means

'ipfs files read': mfs.Lookup of the given path inside the MFS root failed, and the error is wrapped with the path for context. The underlying %w is typically 'no link named ...' (missing entry) or 'invalid path', so the named file does not exist in the files API namespace.

Solutions

  1. List the parent with 'ipfs files ls' to check the exact name
  2. Create the file first (e.g. 'ipfs files write --create')
  3. Fix typos or leading slash usage in the /ipfs-files path
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at core/commands/files.go:846

	},
	Options: []cmds.Option{
		cmds.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin reading from."),
		cmds.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."),
	},
	Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
		nd, err := cmdenv.GetNode(env)
		if err != nil {
			return err
		}

		path, err := checkPath(req.Arguments[0])
		if err != nil {
			return err
		}

		fsn, err := mfs.Lookup(nd.FilesRoot, path)
		if err != nil {
			return fmt.Errorf("%s: %w", path, err)
		}

		fi, ok := fsn.(*mfs.File)
		if !ok {
			return fmt.Errorf("%s was not a file", path)
		}

		rfd, err := fi.Open(req.Context, mfs.Flags{Read: true})
		if err != nil {
			return err
		}

		defer rfd.Close()

		offset, _ := req.Options[offsetOptionName].(int64)
		if offset < 0 {
			return fmt.Errorf("cannot specify negative offset")
		}

View on GitHub (pinned to 329838acdf)