ipfs/kubo · warning

source field %s does not exist

Error message

source field %s does not exist

What it means

migrations.MoveField returns this when the source field `from` does not exist in the config map (GetField reported !exists). Migration helpers assume the field is present when reorganizing old configs into new shapes.

Source

Thrown at repo/fsrepo/migrations/common/config_helpers.go:108

		return false
	}

	parentMap, ok := parent.(map[string]any)
	if !ok {
		return false
	}

	fieldName := parts[len(parts)-1]
	_, exists = parentMap[fieldName]
	delete(parentMap, fieldName)
	return exists
}

// MoveField moves a field from one location to another
func MoveField(config map[string]any, from, to string) error {
	value, exists := GetField(config, from)
	if !exists {
		return fmt.Errorf("source field %s does not exist", from)
	}

	SetField(config, to, value)
	DeleteField(config, from)
	return nil
}

// RenameField renames a field within the same parent
func RenameField(config map[string]any, path, oldName, newName string) error {
	var parent map[string]any
	if path == "" {
		parent = config
	} else {
		p, exists := GetField(config, path)
		if !exists {
			return fmt.Errorf("parent path %s does not exist", path)
		}
		var ok bool

View on GitHub (pinned to 329838acdf)

Solutions

  1. Check the field exists first with GetField and skip MoveField if absent
  2. Make the migration idempotent: if GetField(config, to) already has the value, return nil
  3. Manually inspect ~/.ipfs/config and add the missing field or migrate by hand

Example fix

// before
if err := MoveField(config, "Experimental.ShardingEnabled", "Replication"); err != nil { return err }
// after
if _, exists := GetField(config, "Experimental.ShardingEnabled"); exists {
    if err := MoveField(config, "Experimental.ShardingEnabled", "Replication"); err != nil { return err }
}
Defensive patterns

Strategy: validation

Validate before calling

if _, exists := GetField(config, from); !exists {
    return nil // nothing to move; migration already applied or field never set
}

Try / catch

if err := MoveField(config, from, to); err != nil {
    if strings.Contains(err.Error(), "does not exist") { return nil } // idempotent skip
    return err
}

Prevention

When it happens

Trigger: Running a migration (e.g. ipfs migrate to a new version) on a config file where the expected field was never set, already moved, removed, or spelled differently; running the same migration twice.

Common situations: Users with hand-edited or very old/minimal configs upgrading Kubo; re-running interrupted migrations where the field was already relocated to `to`.

Related errors


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