ipfs/kubo · error

no matching options given

Error message

no matching options given

What it means

`ipfs p2p close` requires the user to say what to close. The command checks that at least one selector was given: --all, or a protocol (-p), listen address (-l), or target (-t) filter. If none is present it returns this error rather than guessing.

Source

Thrown at core/commands/p2p.go:533

		var target, listen ma.Multiaddr

		if l {
			listen, err = ma.NewMultiaddr(listenOpt)
			if err != nil {
				return err
			}
		}

		if t {
			target, err = ma.NewMultiaddr(targetOpt)
			if err != nil {
				return err
			}
		}

		if !(closeAll || p || l || t) {
			return errors.New("no matching options given")
		}

		if closeAll && (p || l || t) {
			return errors.New("can't combine --all with other matching options")
		}

		match := func(listener p2p.Listener) bool {
			if closeAll {
				return true
			}
			if p && proto != listener.Protocol() {
				return false
			}
			if l && !listen.Equal(listener.ListenAddress()) {
				return false
			}
			if t && !target.Equal(listener.TargetAddress()) {
				return false

View on GitHub (pinned to 329838acdf)

Solutions

  1. Close everything with `ipfs p2p close --all`.
  2. Close a specific tunnel by selector, e.g. `ipfs p2p close -p /p2p/myapp/1.0.0`, `-l <listen-addr>`, or `-t <target>`.
  3. Fix scripts that pass empty selector variables so at least one selector (or --all) is always present.

Example fix

// before
ipfs p2p close
// after
ipfs p2p close --all        # or: ipfs p2p close -p /p2p/myapp/1.0.0
Defensive patterns

Strategy: validation

Validate before calling

if !closeAll && proto == "" && listen == "" && target == "" {
    return errors.New("specify --all or one of -p/-l/-t for 'ipfs p2p close'")
}
if closeAll && (proto != "" || listen != "" || target != "") {
    return errors.New("--all cannot be combined with -p/-l/-t")
}

Prevention

When it happens

Trigger: Running `ipfs p2p close` with no arguments and none of the --all / --protocol / --listen / --target options; also invalid: combining --all with any of the other selectors (separate error, same call site block).

Common situations: Typing `ipfs p2p close` expecting it to close everything without --all; forgetting that protocol filters need `-p <proto>`; scripts that drop empty optional arguments leaving no selector at all.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


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