Ecto.ConstraintError: constraint error when attempting to insert struct:
Open
Nobody has claimed this yet.
bug
- Dominant language
- Elixir
- Stars
- 296
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 50
Description
Sentry Issue: LIGHTNING-193
Ecto.ConstraintError: constraint error when attempting to insert struct:
* "dataclips_pkey" (unique_constraint)
If you would like to stop this constraint violation from raising an
exception and instead add it as an error to your changeset, please
call `unique_constraint/3` on your changeset with the constraint
`:name` as an option.
The changeset defined the following constraints:
* "dataclips_source_step_fkey" (foreign_key_constraint)
File "lib/ecto/repo/schema.ex", line 1052, in anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/3
File "lib/enum.ex", line 1714, in Enum."-map/2-lists^map/1-1-"/2
File "lib/ecto/repo/schema.ex", line 1035, in Ecto.Repo.Schema.constraints_to_errors/3
File "lib/ecto/repo/schema.ex", line 1005, in Ecto.Repo.Schema.apply/4
File "lib/ecto/repo/schema.ex", line 500, in anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
...
(3 additional frame(s) were not displayed)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Sentry issue and trace the Lightning code path that inserts the dataclips record; the report only identifies Ecto.Repo.Schema and the dataclips_pkey conflict. Determine why the insert can reuse that primary key and verify the fix with the relevant dataclips tests or an added regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100