"cannot modify player data"

i want to get data from @s's scoreboard value and put it into his mainhand item's custom data. to achieve this, i used execute store... but for some reason i get the error unable to modify player data. why is this happening and how do i prevent the command from failing? whole command: execute store result entity @s SelectedItem.components."minecraft:custom_data".testdata int 1 run scoreboard players get @s some.scoreboard
Continue to help post