Immutable solution version
EdgeDB restore fails with 'role already present in the schema' when the instance was bootstrapped with a custom role
Complete solution
How to fix: EdgeDB restore fails with 'role already present in the schema' when the instance was bootstrapped with a custom role. That error happens because the target instance already contains the role you are trying to restore, and EdgeDB never overwrites existing schema objects during restore. The custom role got baked in because the container was first started with a non-default EDGEDB_USER.
The problem
A full EdgeDB dump would not restore with SchemaError: role 'myuser' is already present in the schema, even with --allow-non-empty --all. The root cause is that unlike Postgres, EdgeDB refuses to restore schema objects that already exist in the target, and the user's Docker setup booted the instance with a custom EDGEDBUSER, so the custom role was already baked into the fresh data volume. The working recipe from the thread is to dump from the original volume, then restore into a brand new empty data volume bootstrapped with the default edgedb role (remove EDGEDBUSER from the compose file), without running any migrations before the restore. The reporter confirmed the restore completed cleanly this way and published the full scripts as a gist. The EdgeDB team also said they would make dumps tolerant of overlapping roles in beta 2.
What fixed it
That error happens because the target instance already contains the role you are trying to restore, and EdgeDB never overwrites existing schema objects during restore. The custom role got baked in because the container was first started with a non-default EDGEDBUSER. Start a fresh data volume with the default edgedb role (drop EDGEDBUSER from your compose or init config), then run the restore before applying any migrations. The reporter verified this restores the full backup successfully. Longer term, the team planned to teach the dumper to tolerate overlapping roles.
Evidence
A user asked: A full EdgeDB dump would not restore with SchemaError: role 'myuser' is already present in the schema, even with --allow-non-empty --all. The root cause is that unlike Postgres, EdgeDB refuses to restore schema objects that already exist in the target, and the user's Docker setup booted the instance with a custom EDGEDBUSER, so the custom role was already baked into the fresh data volume. The working recipe from the thread is to dump from the original volume, then restore into a brand new empty data volume bootstrapped with the default edgedb role (remove EDGEDBUSER from the compose file), without running any migrations before the restore. The reporter confirmed the restore completed cleanly this way and published the full scripts as a gist. The EdgeDB team also said they would make dumps tolerant of overlapping roles in beta 2. The verified answer: That error happens because the target instance already contains the role you are trying to restore, and EdgeDB never overwrites existing schema objects during restore. The custom role got baked in because the container was first started with a non-default EDGEDBUSER. Start a fresh data volume with the default edgedb role (drop EDGEDBUSER from your compose or init config), then run the restore before applying any migrations. The reporter verified this restores the full backup successfully. Longer term, the team planned to teach the dumper to tolerate overlapping roles. Thread: https://vectle.com/threads/thr_iXFeAyWBSOzaHNL5StJbCA
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_GzGZJw2x-S1ZHwhYRdz0mg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">EdgeDB restore fails with 'role already present in the schema' when the instance was bootstrapped with a custom role <span>— Vectle</span></a>