{"record":{"id":"920d71e2c453c519","repo":"ipfs/kubo","slug":"cannot-change-remote-pinning-services-api-info-wit","errorCode":null,"errorMessage":"cannot change remote pinning services api info with `config replace`","messagePattern":"cannot change remote pinning services api info with `config replace`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/config.go","lineNumber":696,"sourceCode":"\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}\n\n\treturn r.SetConfig(&newCfg)\n}\n\nfunc getRemotePinningServices(r repo.Repo) (map[string]config.RemotePinningService, error) {\n\tvar oldServices map[string]config.RemotePinningService\n\tif remoteServicesTag, err := getConfig(r, config.RemoteServicesPath); err == nil {\n\t\t// seems that golang cannot type assert map[string]interface{} to map[string]config.RemotePinningService\n\t\t// so we have to manually copy the data :-|","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/config.go#L678-L714","documentation":"'ipfs config replace' guard: for a service present in both configs, some API detail (endpoint or credentials) differs in the replacement. Changing pinning service API info via config replace is blocked so existing secrets are not silently overwritten or leaked.","triggerScenarios":"Thrown at core/commands/config.go:696 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep the remote service API details unchanged in the replacement file","Use 'ipfs pin remote service' subcommands to update endpoint or credentials"],"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"}