OHDSI / OHDSI/WebAPI

Error saving concept set

Open
#2,430 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
151
Forks
183
Avg merge
14m
Merged PRs (30d)
2

Description

Users in the Atlas are getting an error when attempting to save a concept set expression.

When looking at the logs:

Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into webapi.concept_set_version (archived, asset_json, comment, created_by_id, created_date, asset_id, version) values (('FALSE'::boolean), ('[]'), (NULL), ('1025'::int8), ('2025-02-26 15:11:02.313+00'), ('9356'::int8), ('1'::int4)) was aborted: ERROR: insert or update on table "concept_set_version" violates foreign key constraint "fk_concept_set_version_asset_id"
  Detail: Key (asset_id)=(9356) is not present in table "concept_set".  Call getNextException to see other errors in the batch.

sampleJson.txt

Steps to reproduce:
  1. Create a new concept set
  2. Go to Import tab and use the above JSON to import
  3. Change the name to 'Save Error Test' and click save
  4. Observe: concept set saves
  5. Change the name to 'Save Error Test RENAME
  6. Observe error in logs

Note: This is not always reproducable. It is unclear if there's a sync issue between the versioning of the asset or a race condition of saving of the asset: is it possible that while the versioning save is being done, the save operation of the concept set is ongoing which leads to a delete-insert of the data while the version is looking for the foreign key?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Atlas concept-set import and rename flow, using sampleJson.txt to reproduce the failure and the PostgreSQL foreign-key log to trace the save sequence. Determine why concept_set_version can reference a missing concept_set during save, then verify that repeated create, import, rename, and save operations complete without the constraint error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.