ipfs/kubo · error

msg (server-provided error message)

Error message

msg (server-provided error message)

What it means

parseErrNotFoundWithFallbackToMSG first tries to interpret the daemon's error string as a structured 'ipld not found' error; if it cannot, it returns the raw server-provided message wrapped in errors.New(msg). The message text is whatever the daemon sent, so its content is not produced by this library.

Source

Thrown at client/rpc/errors.go:40

func (e prePostWrappedNotFoundError) String() string {
	return e.Error()
}

func (e prePostWrappedNotFoundError) Error() string {
	return e.pre + e.wrapped.Error() + e.post
}

func (e prePostWrappedNotFoundError) Unwrap() error {
	return e.wrapped
}

func parseErrNotFoundWithFallbackToMSG(msg string) error {
	err, handled := parseErrNotFound(msg)
	if handled {
		return err
	}

	return errors.New(msg)
}

func parseErrNotFoundWithFallbackToError(msg error) error {
	err, handled := parseErrNotFound(msg.Error())
	if handled {
		return err
	}

	return msg
}

func parseErrNotFound(msg string) (error, bool) {
	if msg == "" {
		return nil, true // Fast path
	}

	if err, handled := parseIPLDErrNotFound(msg); handled {
		return err, true

View on GitHub (pinned to 329838acdf)

Solutions

  1. Read the message text: it is the daemon's own error, and the fix depends on what the daemon said (path missing, permission denied, timeout, etc.).
  2. If the path truly exists, verify you are connecting to the intended node (Addresses.API / --api) and that the CID/path is correct.
  3. Upgrade go-ipfs-api so more daemon error strings are parsed into typed errors instead of falling back to raw text.
Defensive patterns

Strategy: try-catch

Type guard

func isNotFound(err error) bool {
    var nf iface.ErrIsDir // example narrowing; primary check is string pattern
    if errors.As(err, &nf) { return true }
    return strings.Contains(err.Error(), "not found")
}

Try / catch

_, err := api.Dag().Get(ctx, p)
if err != nil {
    if strings.Contains(err.Error(), "not found") {
        // handle absence
    } else {
        // raw server error; inspect message and daemon logs
    }
}

Prevention

When it happens

Trigger: Any RPC call (e.g. api.Object().Get, api.Dag().Get via this helper path) whose daemon response is an error that does not match the recognized 'not found under ...' pattern — for example a permission, timeout, or generic server error passed through this fallback.

Common situations: Daemon-side errors like 'file does not exist', blocked/permission errors, or new daemon error formats the old client does not recognize arriving during dag/object lookups.

Related errors


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/3ddc39d65a8584a9. Report an issue: GitHub.