I am struggling to use the api to insert an enum option as the first option in an existing custom field. When I try to do so, passing in the gid of the first (index:0) existing enum option, I get the error, custom_field_enum_option_not_existing and it tells me that gid is invalid.
When I pass in the second gid (index:1) as my insert_before value, the api call runs just fine.
Inserting before the first item does work, and I think the source of your issue is not a bug, although one could certainly argue it’s not intuitively obvious: I think the issue is that your first item is not an active enum option, meaning, as per the docs:
Setting enabled=false is equivalent to “trashing” the enum option in the Asana web app
I’d have spun my wheels on this for a long time without your help. The docs give zero indication this might be true. There’s no mention of enabled needing to be true on the description of insert_before and insert_after.
The error message received contains no clues and the fact that enabled=false enum items maintain their order makes this even more counterintuitive.