# Can anyone guide me how to resolve this error: KeyError: ‘code’

**URL:** https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173
**Category:** Developer
**Created:** [January 8, 2025, 6:55pm UTC](https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173 "2025-01-08T18:55:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![sameerhassan888](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sameerhassan888/32/2996_2.png) [@sameerhassan888](https://discuss.tryton.org/u/sameerhassan888)
#### Post date: [January 8, 2025, 6:55pm UTC](https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173/1 "2025-01-08T18:55:07Z")

</div>

```auto
(tryton:34725): dbind-WARNING **: 23:44:41.870: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
ERROR:tryton.common.common: File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/form.py", line 297, in sig_switch
    self.screen.switch_view()
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/screen/screen.py", line 538, in switch_view
    self.load_view_to_load()
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/screen/screen.py", line 565, in load_view_to_load
    self.add_view_id(view_id, view_type)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/screen/screen.py", line 581, in add_view_id
    return self.add_view(view)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/screen/screen.py", line 608, in add_view
    view = View.parse(
           ^^^^^^^^^^^
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/ __init__.py", line 74, in parse
    return ViewForm(view_id, screen, root)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 460, in __init__
    super(). __init__ (view_id, screen, xml)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/ __init__.py", line 35, in __init__
    ).parse(xml)
      ^^^^^^^^^^
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/ __init__.py", line 131, in parse
    parser(node, node_attrs)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 214, in _parse_form
    self.parse_child(node, container)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 221, in parse_child
    self.parse(child)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/ __init__.py", line 131, in parse
    parser(node, node_attrs)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 346, in _parse_notebook
    self.parse_child(node, notebook)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 221, in parse_child
    self.parse(child)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/ __init__.py", line 131, in parse
    parser(node, node_attrs)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 375, in _parse_page
    self.parse_child(node, container)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 221, in parse_child
    self.parse(child)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/ __init__.py", line 131, in parse
    parser(node, node_attrs)
  File "/home/Sameer/.local/lib/python3.12/site-packages/tryton/gui/window/view_form/view/form.py", line 231, in _parse_field
    widget = self.WIDGETS[attributes['widget']](self.view, attributes)
             ~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^

KeyError: 'code'

```

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [January 8, 2025, 7:15pm UTC](https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173/2 "2025-01-08T19:15:40Z")

</div>

You are using a form view which contains a field with the `widget` attribute set to `code` which is not a widget supported by the standard client.  
Maybe your code depends on a client plugin that register such widget.

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [January 9, 2025, 3:57pm UTC](https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173/3 "2025-01-09T15:57:27Z")

</div>

Yes, if you’re using the `html_report` or `babi` modules both depend on the `widgets` module and you must use a patched version of sao to include those widgets.

I can provide that to you but note that it will only work starting on version 6.8 and you need to use sao.

---

<div class="post-metadata">

### Author: ![sameerhassan888](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sameerhassan888/32/2996_2.png) [@sameerhassan888](https://discuss.tryton.org/u/sameerhassan888)
#### Post date: [January 9, 2025, 5:34pm UTC](https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173/4 "2025-01-09T17:34:04Z")

</div>

yes please provide me this version to this email [sameerhassan888@gmail.com](mailto:sameerhassan888@gmail.com)

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [January 9, 2025, 5:47pm UTC](https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173/6 "2025-01-09T17:47:44Z")

</div>

Here it is:

> **[custom.js](https://drive.google.com/file/d/1PLhNE6vFpSUsbmvB37CoVPjK9Kiwtp_e/view)**
>
> Google Drive file.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [January 10, 2025, 5:48pm UTC](https://discuss.tryton.org/t/can-anyone-guide-me-how-to-resolve-this-error-keyerror-code/8173/7 "2025-01-10T17:48:18Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
