Drupal Version
D10
Domain module version
2.0.0-rc1
Issue summary
I was working on a legacy project where client had reported a bug of two different pages sharing content (we have domain access enabled and the contents where only assign to 1 domain, but visible on 2). this project have up to 14 domains but the problem was only on 2 of them
We found the problem was related with the domain_id var, most likely because someone copied the config of the domain 1 to create domain 2, but they only change the hostname and the id, not the domain_id
Possible solution
I think on a config import there should be a check, as there is one that checks if hostname or id are already in use
Steps to reproduce
- Copy a domain.record configuracion
- Change only hostname and id
- import
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | Capture d’écran 2026-01-29 à 16.24.06.png | 274.94 KB | mably |
| #9 | Capture d’écran 2026-01-29 à 12.29.36.png | 77.02 KB | mably |
Issue fork domain-3570251
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mably commentedWe could try displaying an error in the site dashboard in case of duplicated domain_id.
Could that help?
Comment #3
mably commentedComment #4
paucala commentedIf i try to change diractly in the configuration something, but the id or hostname are alredy in use, an error displays on my console (i'm doing it with drush cim)
"Unexpected error during update for domain.record.X The hostname Y is already registred"
The same with id
But when I use the same domain_id it does'nt give any error, it should give the same
I don't know if that what you're suggesting
Comment #5
mably commentedThere is nothing we can do about manual configuration editing I think. But I'm no expert there.
I was just suggesting to display a warning message on the Drupal dashboard when such duplicated domain_ids exist.
I guess we can also regenerate that id programmatically. That will require to rebuild permissions after.
Comment #6
paucala commentedSo you mean that the check on the hostname or id is applied outside the domain module?
Comment #7
mably commentedAh, you mean, you are editing the domain records using the Domain module configuration screen?
You are talking about this message here?
https://git.drupalcode.org/project/domain/-/blob/3.0.0-beta1/domain/src/...
We could add a similar check here for
domain_idfor sure.Is it what you think would be the best solution to your problem?
EDIT: Actually it's using the
domain_idto check for duplicatehostname... 🤔Not really sure what to do here.
The simpler seems to display an error message on the Drupal dashboard in case of duplicate
domain_id.Comment #9
mably commentedHere is the message that is displayed on the Drupal dashboard with current MR:
@paucala could this be a solution to your problem?
Comment #10
mably commentedComment #11
mably commentedFYI you can easily change the value of the
domain_idof your domain record by using the Config Editor of the Devel module.Or you can simply do an export/import of the corresponding configuration file via the Configuration > Development > Configuration synchronisation menu.
Comment #12
mably commentedLooks like we can implement an event listener which listen to ConfigEvents::IMPORT_VALIDATE events to validate configuration on import.
Will have a look at it.
Comment #13
mably commentedUpdated MR with a config import validator.
Here is what we get:
Comment #14
mably commentedLooks like the original problem is solved.
Can you confirm @paucala?
Comment #15
paucala commentedYes @mably, I think that solves it, thank you
I assume this will also work if you are importing with drush instead of Drupal dashboard
Thank's
Comment #16
mably commentedOk, let's merge this, thanks!
Comment #20
mably commented