Skip to content

[Bug]: Unable to Generate or Create RSA key and throw error ("AttributeError: 'UserKeyForm' object has no attribute 'fieldsets'. Did you mean: 'fields'?") #199

@tasuke93

Description

@tasuke93

NetBox Secrets plugin version

v2.2.1

NetBox version

v4.2.9-Docker-3.2.1

Steps to Reproduce

try roll back to use version 2.2.0 the issue still persist

  1. login using admin account
  2. go to secret -> Add user Key
  3. Generate A new Key Pair
  4. no RSA Key was generate

try to generate manually

  1. login using admin account
  2. go to secret -> Add user Key
  3. paste Public Key in the box
  4. throw error Server Error
    `class 'AttributeError'>

'str' object has no attribute '_meta'`

Expected Behavior

the user keys should be able to create or generate a new key pair

Observed Behavior

Debug Log:
2025-06-16 14:44:42,194 django.template DEBUG: Exception while resolving variable 'fieldsets' in template 'netbox_secrets/userkey_edit.html'. Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.12/site-packages/django/forms/forms.py", line 174, in __getitem__ field = self.fields[name] ~~~~~~~~~~~^^^^^^ KeyError: 'fieldsets' During handling of the above exception, another exception occurred: File "/opt/netbox/venv/lib/python3.12/site-packages/django/template/base.py", line 883, in _resolve_lookup current = current[bit] ~~~~~~~^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/forms/forms.py", line 176, in __getitem__ raise KeyError( KeyError: "Key 'fieldsets' not found in 'UserKeyForm'. Choices are: public_key." File "/opt/netbox/venv/lib/python3.12/site-packages/django/template/base.py", line 893, in _resolve_lookup ^^^^^^^^^^^^^^^^^^^^^ current = getattr(current, bit) AttributeError: 'UserKeyForm' object has no attribute 'fieldsets'. Did you mean: 'fields'? File "/opt/netbox/venv/lib/python3.12/site-packages/django/template/base.py", line 899, in _resolve_lookup current = current[int(bit)] ^^^^^^^^ ValueError: invalid literal for int() with base 10: 'fieldsets' File "/opt/netbox/venv/lib/python3.12/site-packages/django/template/base.py", line 906, in _resolve_lookup raise VariableDoesNotExist( django.template.base.VariableDoesNotExist: Failed lookup for key [fieldsets] in <UserKeyForm bound=False, valid=Unknown, fields=(public_key)> 2025-06-16 14:44:42,215 netbox.config DEBUG: Cleared configuration

Image

Image

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions