If it's crash bars then there are two things to do. Both happened to me.
The first time I had rattle I loosened all bolts on crash bars and then tighten a bit all of them, then tighten a bit again, then tighten to torque specs. You have to do them all at the same time, not loose and tighten one by one, arse loose all of them and then start tightening all of them arround (I hope I made myself understandable).
The second time it happened, it was worse. The rattle was loud. So during the ride I would put my hand on bars and move it arround. I found out that if I grab left bar it stopped rattling. Later I did slow investigation, inch by inch on left crash bar and found out the crack on it (Givi Bars). Welded that spot at the dealer and it's all good ever since. The dealer did one smart thing. He didn't remove the bar and then welded it because, he said, if he did it he would introduce back the stress on the bar. He rather spot-welded it while mounted on the bike and then removed it and did proper welding. He said after it cracked it released the stress so it was smart to weld it with stress released. I have very good dealer.