ipfs/kubo · error

cannot add or remove remote pinning services with 'config re

Error message

cannot add or remove remote pinning services with 'config replace'

What it means

'ipfs config replace' guard: the replacement config's Pinning.RemoteServices list has a different number of services than the current one. Adding or removing pinning services through config replace is not allowed (secret-handling rules); use 'ipfs pin remote service add/remove' to change the list first.

Source

Thrown at core/commands/config.go:687

	newCfg.Identity.PrivKey = pkstr
	id, err := nodePeerID(r)
	if err != nil {
		return err
	}
	newCfg.Identity.PeerID = id.String()

	// Handle Pinning.RemoteServices (API.Key of each service is a secret)

	newServices := newCfg.Pinning.RemoteServices
	oldServices, err := getRemotePinningServices(r)
	if err != nil {
		return fmt.Errorf("failed to load remote pinning services info (%v)", err)
	}

	// fail fast if service lists are obviously different
	if len(newServices) != len(oldServices) {
		return errors.New("cannot add or remove remote pinning services with 'config replace'")
	}

	// re-apply API details and confirm every modified service already existed
	for name, oldSvc := range oldServices {
		if newSvc, hadSvc := newServices[name]; hadSvc {
			// fail if input changes any of API details
			// (interop with config show: allow Endpoint as long it did not change)
			if len(newSvc.API.Key) != 0 || (len(newSvc.API.Endpoint) != 0 && newSvc.API.Endpoint != oldSvc.API.Endpoint) {
				return errors.New("cannot change remote pinning services api info with `config replace`")
			}
			// re-apply API details and store service in updated config
			newSvc.API = oldSvc.API
			newCfg.Pinning.RemoteServices[name] = newSvc
		} else {
			// error on service rm attempt
			return errors.New("cannot add or remove remote pinning services with 'config replace'")
		}
	}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Align the service list in the replacement file with the current one
  2. Add or remove services with 'ipfs pin remote service' before or instead of config replace
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/commands/config.go:687 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/56bb3d1ae036b27c. Report an issue: GitHub.