Skip to content

fix: retry UniProt ID-mapping jobs on error code 50 - #15

Merged
iquasere merged 1 commit into
iquasere:masterfrom
arog-bioinfo:fix-uniprot_idmapping_retries
Oct 26, 2026
Merged

iquasere merged 1 commit into
iquasere:masterfrom
arog-bioinfo:fix-uniprot_idmapping_retries

Conversation

@arog-bioinfo

Copy link
Copy Markdown
Contributor

Problem

Hi! While I was using UPIMAPI to annotate metagenomic bins I occasionally encountered a UniProt server-side error that caused the annotation to stall in the UPIMAPI job.

When UniProt marks an asynchronous ID-mapping job as failed, its status endpoint can return HTTP 400 with jobStatus: "ERROR" and error code 50. Because requests.get() returns this as a response rather than raising an exception, get_url() did not increment its retry counter or leave the loop. It consequently kept requesting the status of the same failed job, which could never recover.

Solution

This change identifies server-side failures from general HTTP 5xx responses and terminal UniProt responses containing jobStatus: "ERROR" with error code 50.

These responses raise a dedicated UniProtServerError. To prevent a UniProt-side failure from stopping the entire UPIMAPI run, the ID-mapping batch functions catch this error and submit the same chunk again, producing a new job ID instead of continuing to poll the failed job. Fresh submissions are limited by the existing --max-tries setting, preventing another infinite retry loop. Other HTTP errors continue to propagate normally and do not trigger a new submission.

I performed local tests covering the observed code-50 response and the fix appears to work as intended.

@iquasere iquasere left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice

@iquasere
iquasere merged commit 7b3e1f1 into iquasere:master Oct 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants