ipfs/kubo · error

--%s implies --offline and cannot be combined with --offline

Error message

--%s implies --offline and cannot be combined with --offline=false; please drop one of them

What it means

The `ipfs dag export` command returns this when the user passes `--local-only` together with an explicit `--offline=false`. `--local-only` means the export must be served purely from the local blockstore, which necessarily implies offline behavior, so the two flags are logically contradictory. The command fails fast before any API call is made rather than guessing which flag wins.

Source

Thrown at core/commands/dag/export.go:46

// pb/v3 template for `ipfs dag export`: byte counter, speed, and
// elapsed time. No bar/percent/ETA because the total size of the
// CAR stream is not known up front. The explicit "%s/s" speed
// format overrides pb's default "p/s" suffix so the rate renders
// as "MiB/s".
const progressBarTemplate = `{{counters . }} {{speed . "%s/s" "?/s"}} {{etime . }}`

func dagExport(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
	// Accept CID or a content path
	p, err := cmdutils.PathOrCidPath(req.Arguments[0])
	if err != nil {
		return err
	}

	localOnly, _ := req.Options[localOnlyOptionName].(bool)
	if localOnly {
		// --local-only and --offline=false contradict each other.
		if offline, set := req.Options["offline"].(bool); set && !offline {
			return fmt.Errorf("--%s implies --offline and cannot be combined with --offline=false; please drop one of them", localOnlyOptionName)
		}
	}

	api, err := cmdenv.GetApi(env, req)
	if err != nil {
		return err
	}
	if localOnly {
		// --local-only implies --offline so api.Block().Stat below cannot
		// reach out for path resolution. The DAG walk itself uses the raw
		// blockstore via walker (see exportPartialCAR) and is local by
		// construction regardless of this setting.
		api, err = api.WithOptions(options.Api.Offline(true))
		if err != nil {
			return err
		}
	}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Drop `--offline=false` from the command line; `--local-only` already implies offline behavior.
  2. If you truly want online fetching, remove `--local-only` instead and keep the node online.
  3. Fix any wrapper script/alias that injects `--offline=false` unconditionally.

Example fix

// before
ipfs dag export --local-only --offline=false bafy... > out.car

// after
ipfs dag export --local-only bafy... > out.car
Defensive patterns

Strategy: validation

Validate before calling

if local_only and not offline:
    raise ValueError("--local-only implies --offline; drop --offline=false")

Prevention

When it happens

Trigger: Running `ipfs dag export --local-only --offline=false <cid>` (or scripting that sets localOnlyOptionName=true while leaving a leftover offline=false option). The check fires only when `offline` was explicitly set to false; omitting `--offline` entirely is fine because local-only then implies offline silently.

Common situations: Shell aliases or wrapper scripts that always append `--offline=false`; combining an old documented invocation with a new `--local-only` flag; CI scripts templated with both options for flexibility.

Related errors


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