{"record":{"id":"56bb3d1ae036b27c","repo":"ipfs/kubo","slug":"cannot-add-or-remove-remote-pinning-services-with","errorCode":null,"errorMessage":"cannot add or remove remote pinning services with 'config replace'","messagePattern":"cannot add or remove remote pinning services with 'config replace'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/config.go","lineNumber":687,"sourceCode":"\n\tnewCfg.Identity.PrivKey = pkstr\n\tid, err := nodePeerID(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewCfg.Identity.PeerID = id.String()\n\n\t// Handle Pinning.RemoteServices (API.Key of each service is a secret)\n\n\tnewServices := newCfg.Pinning.RemoteServices\n\toldServices, err := getRemotePinningServices(r)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load remote pinning services info (%v)\", err)\n\t}\n\n\t// fail fast if service lists are obviously different\n\tif len(newServices) != len(oldServices) {\n\t\treturn errors.New(\"cannot add or remove remote pinning services with 'config replace'\")\n\t}\n\n\t// re-apply API details and confirm every modified service already existed\n\tfor name, oldSvc := range oldServices {\n\t\tif newSvc, hadSvc := newServices[name]; hadSvc {\n\t\t\t// fail if input changes any of API details\n\t\t\t// (interop with config show: allow Endpoint as long it did not change)\n\t\t\tif len(newSvc.API.Key) != 0 || (len(newSvc.API.Endpoint) != 0 && newSvc.API.Endpoint != oldSvc.API.Endpoint) {\n\t\t\t\treturn errors.New(\"cannot change remote pinning services api info with `config replace`\")\n\t\t\t}\n\t\t\t// re-apply API details and store service in updated config\n\t\t\tnewSvc.API = oldSvc.API\n\t\t\tnewCfg.Pinning.RemoteServices[name] = newSvc\n\t\t} else {\n\t\t\t// error on service rm attempt\n\t\t\treturn errors.New(\"cannot add or remove remote pinning services with 'config replace'\")\n\t\t}\n\t}","sourceCodeStart":669,"sourceCodeEnd":705,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/config.go#L669-L705","documentation":"'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.","triggerScenarios":"Thrown at core/commands/config.go:687 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Align the service list in the replacement file with the current one","Add or remove services with 'ipfs pin remote service' before or instead of config replace"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}