Skip to content

Fix 400 error when using multi-select on integer/float fields - #747

Draft
theosanderson with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-adding-two-groups-error
Draft

theosanderson with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-adding-two-groups-error

Conversation

Copilot AI commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

Multi-select integer fields (e.g., groupId) cause LAPIS to return 400 errors. URL parameters are parsed as string arrays ["498", "562"] but LAPIS expects numeric types for int/float fields.

Changes

Modified SequenceFilters.tsx:

  • Added type conversion in toApiParams() for fields with type: 'int' or type: 'float'
  • Converts string values to numbers while preserving null and handling invalid inputs (passes through for LAPIS error handling)
  • Supports both single values and arrays

Added SequenceFilters.spec.tsx:

  • Test coverage for numeric conversion (single/array, valid/invalid strings, null preservation)

Repository structure:

  • Removed SequenceFilters.tsx from monorepo/.gitignore to track as pathoplexus-specific override
  • Updated root .gitignore to allow tracking monorepo/.gitignore changes

Example

Request payload before (fails):

{
  "groupId": ["498", "562"]  // strings
}

Request payload after (succeeds):

{
  "groupId": [498, 562]  // numbers
}
Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] Adding two groups seems to cause a fail (in at least one circumstance)</issue_title>
<issue_description>Trying to add two groups to a particular search, I got an error. All other search fields were set, the error appeared after typing in and selecting group ID 562:

Image

URL link, which at least as of right now seems to replicate the error:
https://pathoplexus.org/mpox/search?visibility_releasedAtTimestamp=true&isRevocation=&visibility_groupName=true&visibility_groupId=true&visibility_accessionVersion=true&groupId=498&groupId=562&visibility_earliestReleaseDate=true&visibility_version=true&visibility_submittedAtTimestamp=true&visibility_versionStatus=true&earliestReleaseDateFrom=2025-09-17&earliestReleaseDateTo=2025-11-07

You can also replicate it with the above URL by clearing the second group (562), which then displays 21 seqs without error. Then add it back in, to get the error.

Copied error text:

{"message":"Request failed with status code 400","name":"AxiosError","stack":"AxiosError: Request failed with status code 400\n at It (https://pathoplexus.org/_astro/createAuthorizationHeader.IQvkTUFS.js:3:1073)\n at XMLHttpRequest.w (https://pathoplexus.org/_astro/createAuthorizationHeader.IQvkTUFS.js:3:5676)\n at _.request (https://pathoplexus.org/_astro/createAuthorizationHeader.IQvkTUFS.js:5:2056)\n at async Xn.request (https://pathoplexus.org/_astro/createAuthorizationHeader.IQvkTUFS.js:11:4348)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json"},"baseURL":"https://lapis.pathoplexus.org/mpox","method":"post","url":"/sample/details","data":"{\"versionStatus\":\"LATEST_VERSION\",\"groupId\":[\"498\",\"562\"],\"earliestReleaseDateFrom\":\"2025-09-17\",\"earliestReleaseDateTo\":\"2025-11-07\",\"nucleotideMutations\":[],\"aminoAcidMutations\":[],\"nucleotideInsertions\":[],\"aminoAcidInsertions\":[],\"fields\":[\"authorAffiliations\",\"authors\",\"clade\",\"earliestReleaseDate\",\"geoLocAdmin1\",\"geoLocCountry\",\"length\",\"lineage\",\"sampleCollectionDate\",\"accessionVersion\"],\"limit\":100,\"offset\":0,\"orderBy\":[{\"field\":\"sampleCollectionDate\",\"type\":\"descending\"}]}","params":{},"allowAbsoluteUrls":true},"code":"ERR_BAD_REQUEST","status":400}

Request failed with status code 400

Request failed with status code 400
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@theosanderson</author><body>
👍 I expect this is misconfigured and is because this is both an integer and a multi-select thing</body></comment_new>
</comments>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 24, 2025 15:03
…bers

Co-authored-by: theosanderson <19732295+theosanderson@users.noreply.github.com>
Co-authored-by: theosanderson <19732295+theosanderson@users.noreply.github.com>
@theosanderson

Copy link
Copy Markdown
Member

(needs to be fixed in Loculus)

Co-authored-by: theosanderson <19732295+theosanderson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error when adding two groups to search Fix 400 error when using multi-select on integer/float fields Nov 24, 2025
Copilot AI requested a review from theosanderson November 24, 2025 15:09
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.

[BUG] Adding two groups seems to cause a fail (in at least one circumstance)

2 participants