Error after deleting a CustomFieldChoice #448

Closed
opened 2025-12-29 16:22:18 +01:00 by adam · 5 comments
Owner

Originally created by @fabiana275 on GitHub (Sep 27, 2016).

Hello,

I've used custom fields and some of them I have deleted.
But now when I create new tenant and trying to edit it after created I'm receiving that error:
" class 'extras.models.DoesNotExist'

CustomFieldChoice matching query does not exist. "
And go to home page

Could you please assist, how can I repair it?
netbox version: v1.6.1-r1

Originally created by @fabiana275 on GitHub (Sep 27, 2016). Hello, I've used custom fields and some of them I have deleted. But now when I create new tenant and trying to edit it after created I'm receiving that error: " class 'extras.models.DoesNotExist' CustomFieldChoice matching query does not exist. " And go to home page Could you please assist, how can I repair it? netbox version: v1.6.1-r1
adam added the type: bug label 2025-12-29 16:22:18 +01:00
adam closed this issue 2025-12-29 16:22:18 +01:00
Author
Owner

@fabiana275 commented on GitHub (Sep 27, 2016):

It also happening for the devices which are added recently!

@fabiana275 commented on GitHub (Sep 27, 2016): It also happening for the devices which are added recently!
Author
Owner

@jeremystretch commented on GitHub (Sep 27, 2016):

It sounds like you might have created a custom field with choices, and then deleted all the choices for that field. Is that correct? If so, you should be able to resolve this by creating at least one choice for the field, or by simply deleting the custom field.

@jeremystretch commented on GitHub (Sep 27, 2016): It sounds like you might have created a custom field with choices, and then deleted all the choices for that field. Is that correct? If so, you should be able to resolve this by creating at least one choice for the field, or by simply deleting the custom field.
Author
Owner

@fabiana275 commented on GitHub (Sep 27, 2016):

Hi,

There was 2 or more selection choices and i have delete some of them. Now in the custom fields there is at least one choice per field. I have tried to re-create the choices which I have deleted but without success.
After your answer i tried to delete the selection fields, but I have received the following error:

"class 'django.utils.encoding.DjangoUnicodeDecodeError'

'ascii' codec can't decode byte 0xd0 in position 12: ordinal not in range(128). You passed in <CustomFieldValue: [Bad Unicode data]> (<class 'extras.models.CustomFieldValue'>) "

@fabiana275 commented on GitHub (Sep 27, 2016): Hi, There was 2 or more selection choices and i have delete some of them. Now in the custom fields there is at least one choice per field. I have tried to re-create the choices which I have deleted but without success. After your answer i tried to delete the selection fields, but I have received the following error: "class 'django.utils.encoding.DjangoUnicodeDecodeError' 'ascii' codec can't decode byte 0xd0 in position 12: ordinal not in range(128). You passed in <CustomFieldValue: [Bad Unicode data]> (<class 'extras.models.CustomFieldValue'>) "
Author
Owner

@jeremystretch commented on GitHub (Sep 27, 2016):

I'm not sure how deleting a custom field would trigger a Unicode error. Did you try deleting the custom field via the admin UI under Extras > Custom Fields?

@jeremystretch commented on GitHub (Sep 27, 2016): I'm not sure how deleting a custom field would trigger a Unicode error. Did you try deleting the custom field via the admin UI under Extras > Custom Fields?
Author
Owner

@jeremystretch commented on GitHub (Sep 27, 2016):

I've pushed a commit which should address the original bug. Please feel free to open a new issue for the Unicode problem if it persists.

@jeremystretch commented on GitHub (Sep 27, 2016): I've pushed a commit which should address the original bug. Please feel free to open a new issue for the Unicode problem if it persists.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#448