I'm not sure if it's happening on the current release of Grasscutter, but as I've tested it through YuFanXing's fork of it, it didn't work.
I've also found some records of discord chats in this server mentioning the issue.
It seems like line 19 of ItemUseGainCostume.java should be changed to
if (GameData.getAvatarCostumeDataItemIdMap().containsKey(params.usedItemId)) {
to make give command work, and exception checks for scene is required for the constructor of EntityAvatar to make avatar selection work.
I'm writing it here since I'm a noob and I don't wanna mess up your project, but I'll make a PR if needed.