ipfs/kubo · error

cannot use both --allow-offline and --allow-delegated flags

Error message

cannot use both --allow-offline and --allow-delegated flags

What it means

Flag-combination guard in 'ipfs name publish': --allow-offline (local datastore only, no network) and --allow-delegated (local datastore plus HTTP delegated publishers) describe mutually exclusive publish modes and cannot both be set.

Source

Thrown at core/commands/name/publish.go:125

		cmds.BoolOption(allowOfflineOptionName, "Allow publishing when offline - publishes to local datastore without requiring network connectivity."),
		cmds.BoolOption(allowDelegatedOptionName, "Allow publishing without DHT connectivity - uses local datastore and HTTP delegated publishers only."),
		cmds.Uint64Option(sequenceOptionName, "Set a custom sequence number for the IPNS record (must be higher than current)."),
		ke.OptionIPNSBase,
	},
	Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
		api, err := cmdenv.GetApi(env, req)
		if err != nil {
			return err
		}

		allowOffline, _ := req.Options[allowOfflineOptionName].(bool)
		allowDelegated, _ := req.Options[allowDelegatedOptionName].(bool)
		compatibleWithV1, _ := req.Options[v1compatOptionName].(bool)
		kname, _ := req.Options[keyOptionName].(string)

		// Validate flag combinations
		if allowOffline && allowDelegated {
			return errors.New("cannot use both --allow-offline and --allow-delegated flags")
		}

		// --lifetime and --ttl carry no client-side default, so the server can
		// tell whether the user set them explicitly; defaults are applied here.
		validTime := ipns.DefaultRecordLifetime
		if validTimeOpt, found := req.Options[lifeTimeOptionName].(string); found {
			d, err := time.ParseDuration(validTimeOpt)
			if err != nil {
				return fmt.Errorf("error parsing lifetime option: %s", err)
			}
			if d <= 0 {
				return fmt.Errorf("lifetime must be greater than zero, got %s", validTimeOpt)
			}
			validTime = d
		}

		opts := []options.NamePublishOption{
			options.Name.AllowOffline(allowOffline),

View on GitHub (pinned to 329838acdf)

Solutions

  1. Keep --allow-offline if you want a purely local publish with no outbound traffic
  2. Keep --allow-delegated if you want the publish to reach configured delegated IPNS publishers
  3. Drop both flags when online so the record goes to the DHT normally
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/commands/name/publish.go:125 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/8d90e1ba4067cc5d. Report an issue: GitHub.