# Custom module activation bug

**URL:** <https://www.dolibarr.org/forum/t/custom-module-activation-bug/31095>\
**Category:** Developing for Dolibarr\
**Tags:** Issue\
**Created:** [April 1, 2026, 10:01am UTC](https://www.dolibarr.org/forum/t/custom-module-activation-bug/31095 "2026-04-01T10:01:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antonomasia](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@Antonomasia](https://www.dolibarr.org/forum/u/Antonomasia)\
**Post date:** [April 1, 2026, 10:01am UTC](https://www.dolibarr.org/forum/t/custom-module-activation-bug/31095/1 "2026-04-01T10:01:24Z")

</div>

Hi, I’m trying to develop a custom module using the built-in generator in Dolibarr, but I’m stuck because a menu item is not appearing.

I’ve already checked the module name, number, and possible errors, and everything seems correct. The module itself appears to work: the CSS/HTML changes I added are applied correctly and usable.

Normally, I enable the module from the “Modules/Applications” tab. However, in the “App/Module Generator” tab, the module’s toggle always appears as disabled. This made me think I needed to disable it from “Modules/Applications” and enable it from the generator tab instead.

After doing that, I noticed something confusing: clicking the toggle in the generator tab appears to have no visual effect (it stays on “disabled”), but in reality it does enable the module. I can tell because my CSS/HTML changes are applied again, and the module shows as enabled in the “Modules/Applications” tab.

**Steps to reproduce:**

1. Enable the custom module from the “Modules/Applications” tab.
2. Go to the “App/Module Generator” tab → the module toggle appears disabled.
3. Click the enable switch → it still appears disabled (no visual change).
4. Disable the module from the “Modules/Applications” tab.
5. Click the enable switch in the generator tab → the module is actually enabled, but the toggle still appears disabled.

**Additional observation:**  
It seems that clicking the toggle in the generator tab can only _activate_ the module, not properly reflect or control its real state. This likely happens because the toggle relies on its own displayed state rather than the actual module status. As a result, the UI is misleading: even when the module is already enabled, the switch still appears disabled and behaves inconsistently.

At this point, I’m not sure if I’m doing something wrong or if this is a bug. What I’m certain of is that the behavior is inconsistent, and I’m concerned it may be related to the issue with the missing menu item.

**Environment:**

- Dolibarr version: 22.0.3
- OS: Ubuntu 24.04.4 LTS (x86\_64)

EDIT:  
I looked into the logs and found this error:

```auto
2026-04-01 09:41:48 ERR 151.47.201.72 2311 1000 DoliDBMysqli::query Exception in query instead of returning an error: Duplicate key name 'uk_richiestadocumenti_fk_object'
2026-04-01 09:41:48 ERR 151.47.201.72 2311 1000 DoliDBMysqli::query SQL Error message: DB_ERROR_KEY_NAME_ALREADY_EXISTS Duplicate key name 'uk_richiestadocumenti_fk_object' From /var/www/html/debugbar/class/TraceableDB.php:362.

```

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [April 1, 2026, 10:36am UTC](https://www.dolibarr.org/forum/t/custom-module-activation-bug/31095/2 "2026-04-01T10:36:07Z")

</div>

Hey @Antonomasia. Do you run your dolibarr with debug logs? do that reveal anything else?

What about your php/webserver logs, do they reveal anything?

---

<div class="post-metadata">

**Author:** ![Antonomasia](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@Antonomasia](https://www.dolibarr.org/forum/u/Antonomasia)\
**Post date:** [April 1, 2026, 10:51am UTC](https://www.dolibarr.org/forum/t/custom-module-activation-bug/31095/3 "2026-04-01T10:51:11Z")

</div>

> [@jonbendtsen](#):
>
> Do you run your dolibarr with debug logs?

Yes I am.

Where can I find the webserver logs?

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [April 1, 2026, 11:59am UTC](https://www.dolibarr.org/forum/t/custom-module-activation-bug/31095/4 "2026-04-01T11:59:26Z")

</div>

> [@Antonomasia](#):
>
> Where can I find the webserver logs?

I don’t know your setup

---

<div class="post-metadata">

**Author:** ![saikatkoley](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saikatkoley/32/8716_2.png) [@saikatkoley](https://www.dolibarr.org/forum/u/saikatkoley)\
**Post date:** [April 2, 2026, 5:58am UTC](https://www.dolibarr.org/forum/t/custom-module-activation-bug/31095/5 "2026-04-02T05:58:19Z")

</div>

> [@Antonomasia](#):
>
> `uk_richiestadocumenti_fk_object`

Hi @Antonomasia

Your system is trying to **create an index/constraint with a name that already exists** in the same table.

Run this SQL: SHOW INDEX FROM your\_table; and look for uk\_richiestadocumenti\_fk\_object

Only if sure run this ALTER TABLE your\_table DROP INDEX uk\_richiestadocumenti\_fk\_object;

**Thanks & Regards  
Saikat Koley  
Software Developer(Dolibarr)  
Call/WhatsApp : +919903256573  
Email : [saikatkoley@hotmail.com](mailto:saikatkoley@hotmail.com)  
 [https://www.linkedin.com/in/saikatkoley/](https://www.linkedin.com/in/saikatkoley/)**
