{"record":{"id":"18a812697179a334","repo":"ipfs/kubo","slug":"unknown-config-value-migrations-keep-must-be-cac","errorCode":null,"errorMessage":"unknown config value, Migrations.Keep must be 'cache', 'pin', or 'discard'","messagePattern":"unknown config value, Migrations\\.Keep must be 'cache', 'pin', or 'discard'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/fsrepo/migrations/migrations.go","lineNumber":150,"sourceCode":"\t}\n\n\tcfgFile, err := os.Open(cfgPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cfgFile.Close()\n\n\terr = json.NewDecoder(cfgFile).Decode(&cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch cfg.Migration.Keep {\n\tcase \"\":\n\t\tcfg.Migration.Keep = config.DefaultMigrationKeep\n\tcase \"discard\", \"cache\", \"keep\":\n\tdefault:\n\t\treturn nil, errors.New(\"unknown config value, Migrations.Keep must be 'cache', 'pin', or 'discard'\")\n\t}\n\n\tif len(cfg.Migration.DownloadSources) == 0 {\n\t\tcfg.Migration.DownloadSources = config.DefaultMigrationDownloadSources\n\t}\n\n\treturn &cfg.Migration, nil\n}\n\n// GetMigrationFetcher creates one or more fetchers from downloadSources.\n// Multiple fetchers are wrapped in a MultiFetcher that rotates to the next\n// gateway when one errors and quarantines failed gateways for the session.\n//\n// Deprecated: This function is used by legacy migration downloads and will be removed\n// in a future version. Use RunHybridMigrations or RunEmbeddedMigrations instead.\nfunc GetMigrationFetcher(downloadSources []string, distPath string, newIpfsFetcher func(string) Fetcher) (Fetcher, error) {\n\tconst httpUserAgent = \"kubo/migration\"\n","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/migrations/migrations.go#L132-L168","documentation":"ReadMigrationConfig validates the Migrations.Keep config key, which controls how migration-affected data is treated ('cache', 'pin', or the default 'discard' behavior; 'keep' is accepted as an alias). A value outside the accepted set fails validation.","triggerScenarios":"Calling ReadMigrationConfig when the repo config contains Migrations.Keep set to anything other than \"\", \"discard\", \"cache\", or \"keep\" — e.g. a typo like \"pins\" or \"Cache\".","commonSituations":"Hand-editing the kubo config file and misspelling the value; scripts writing Migrations.Keep with wrong casing or an unexpected keyword; copying config from outdated documentation.","solutions":["Set Migrations.Keep in the repo config to exactly \"cache\", \"pin\", or \"discard\" (lowercase).","Run `ipfs config Migrations.Keep cache` (or pin/discard) instead of hand-editing JSON.","Remove the Migrations.Keep key entirely to fall back to the default."],"exampleFix":"// before\n\"Migrations\": { \"Keep\": \"Pins\" }\n// after\n\"Migrations\": { \"Keep\": \"pin\" }","handlingStrategy":"validation","validationCode":"keep := cfg.Migration.Keep\nif keep != \"\" && keep != \"discard\" && keep != \"cache\" && keep != \"keep\" {\n    return fmt.Errorf(\"invalid Migrations.Keep: %q\", keep)\n}","typeGuard":null,"tryCatchPattern":"cfg, err := cmd.ReadMigrationConfig()\nif err != nil {\n    if strings.Contains(err.Error(), \"Migrations.Keep\") {\n        // fix config value\n    }\n}","preventionTips":["Use `ipfs config Migrations.Keep <value>` instead of editing JSON by hand","Keep values lowercase: cache, pin, discard","Omit the key to accept the default"],"tags":["migrations","config-validation","go"],"backgroundTag":"invalid-config-value","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"}