ipfs/kubo · error

--expand-auto can only be used for reading config values, no

Error message

--expand-auto can only be used for reading config values, not for setting them

What it means

'ipfs config' was called with two arguments (a key and a value, i.e. a write) while the --expand-auto flag was set. --expand-auto resolves 'auto' placeholders via AutoConf and is only meaningful for reads; applying expanded values back would overwrite the placeholders permanently.

Source

Thrown at core/commands/config.go:115

		// Temporary fix until we move ApiKey secrets out of the config file
		// (remote services are a map, so more advanced blocking is required)
		if blocked := matchesGlobPrefix(key, config.PinningConcealSelector); blocked {
			return errors.New("cannot show or change pinning services credentials")
		}

		cfgRoot, err := cmdenv.GetConfigRoot(env)
		if err != nil {
			return err
		}
		r, err := fsrepo.Open(cfgRoot)
		if err != nil {
			return err
		}
		defer r.Close()
		if len(args) == 2 {
			// Check if user is trying to write config with expand flag
			if expandAuto, _ := req.Options[configExpandAutoName].(bool); expandAuto {
				return fmt.Errorf("--expand-auto can only be used for reading config values, not for setting them")
			}

			value := args[1]

			// Identity.PeerID is derived from Identity.PrivKey; the node
			// refuses to start when they disagree. Accept only the node's own
			// PeerID in any standard form (base58 or CIDv1), compare decoded
			// IDs rather than strings, store the canonical base58 string kubo
			// writes elsewhere, and point a mismatched value at the supported
			// way to change the identity.
			if strings.EqualFold(key, "identity.peerid") {
				candidate := value
				if parseJSON, _ := req.Options[configJSONOptionName].(bool); parseJSON {
					var s string
					if err := json.Unmarshal([]byte(value), &s); err == nil {
						candidate = s
					}
				}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Drop --expand-auto when setting a value
  2. Use --expand-auto only with single-argument reads: 'ipfs config --expand-auto <key>'
Defensive patterns

Strategy: validation

When it happens

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