Temporal Activity is somehow not generating a new uuid string while using uuid.New()

I have this activity code:

--------- service/main.go ------------
w := worker.New(temporalClient, TemporalTaskQueueName, wo)
w.RegisterWorkflow(dataretention.Workflow)
w.RegisterActivity(a)


------- activity code --------
func (a *Activities) BackupIdentitiesDataToS3(ctx context.Context, options BackupIdentitiesDataToS3Options) (BQResponse, error) {
	// 

	prefix := fmt.Sprintf("identities/%d/%d/%s/%s.parquet", options.Job.ClusterID, options.Job.EnvID, uuid.New().String(), options.Job.RequestID.String())

	// upload to s3 using prefix and bucketname 
	return

}

Here I am using uuid.New to generate random s3 prefix. Now whats happening is, when service restarts, somehow the activity is retried and I am seeing

Failed upload to remote storage.  Key already exists at bucket_name/identities/2/4130814495/1970d68b-88d7-4fe9-8f4a-a5f150d566b3/6ccecc2b-9e1d-4d01-8eb3-c641bd8572be.parquet

If I am using uuid.New in prefix, and activity retries, why am I still getiing same s3 prefix? Is there any internal caching of uuid.New in temporal or something else?

I’d try doing uuid.New() inside workflow code and passing it to activity as a parameter.

Never use uuid.New inside the workflow as it can break determinism. Temporal doesn’t affect code inside the activity in any way. So I’m not sure what the problem is.