{"record":{"id":"9db954e3c3137e1e","repo":"ipfs/kubo","slug":"source-field-s-does-not-exist","errorCode":null,"errorMessage":"source field %s does not exist","messagePattern":"source field (.+?) does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"repo/fsrepo/migrations/common/config_helpers.go","lineNumber":108,"sourceCode":"\t\treturn false\n\t}\n\n\tparentMap, ok := parent.(map[string]any)\n\tif !ok {\n\t\treturn false\n\t}\n\n\tfieldName := parts[len(parts)-1]\n\t_, exists = parentMap[fieldName]\n\tdelete(parentMap, fieldName)\n\treturn exists\n}\n\n// MoveField moves a field from one location to another\nfunc MoveField(config map[string]any, from, to string) error {\n\tvalue, exists := GetField(config, from)\n\tif !exists {\n\t\treturn fmt.Errorf(\"source field %s does not exist\", from)\n\t}\n\n\tSetField(config, to, value)\n\tDeleteField(config, from)\n\treturn nil\n}\n\n// RenameField renames a field within the same parent\nfunc RenameField(config map[string]any, path, oldName, newName string) error {\n\tvar parent map[string]any\n\tif path == \"\" {\n\t\tparent = config\n\t} else {\n\t\tp, exists := GetField(config, path)\n\t\tif !exists {\n\t\t\treturn fmt.Errorf(\"parent path %s does not exist\", path)\n\t\t}\n\t\tvar ok bool","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/migrations/common/config_helpers.go#L90-L126","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users with hand-edited or very old/minimal configs upgrading Kubo; re-running interrupted migrations where the field was already relocated to `to`.","solutions":["Check the field exists first with GetField and skip MoveField if absent","Make the migration idempotent: if GetField(config, to) already has the value, return nil","Manually inspect ~/.ipfs/config and add the missing field or migrate by hand"],"exampleFix":"// before\nif err := MoveField(config, \"Experimental.ShardingEnabled\", \"Replication\"); err != nil { return err }\n// after\nif _, exists := GetField(config, \"Experimental.ShardingEnabled\"); exists {\n    if err := MoveField(config, \"Experimental.ShardingEnabled\", \"Replication\"); err != nil { return err }\n}","handlingStrategy":"validation","validationCode":"if _, exists := GetField(config, from); !exists {\n    return nil // nothing to move; migration already applied or field never set\n}","typeGuard":null,"tryCatchPattern":"if err := MoveField(config, from, to); err != nil {\n    if strings.Contains(err.Error(), \"does not exist\") { return nil } // idempotent skip\n    return err\n}","preventionTips":["Make migrations idempotent by checking source presence first","Handle already-migrated configs (field present at `to`)","Inspect the config file when a migration fails to see actual field names"],"tags":["go","migrations","config"],"backgroundTag":"missing-config-field","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}