You have an if-else statement. It’s not possible unless you are running the loop several times or you have an inconsistent loop which writes in the list several times the same parameter.
By definition
for , in model.named_parameters() iterates over the model parameters only once. If you are appending a parameter more than once you committed a mistake in there