R2R icon indicating copy to clipboard operation
R2R copied to clipboard

when ingest document with collection_ids error occurs

Open zhengwj533 opened this issue 8 months ago • 0 comments
trafficstars

Describe the bug when ingest document with collection_ids error occurs.

To Reproduce

ingest request like this, with collection_ids.

POST /v3/documents HTTP/1.1
Content-Length: 4372
Content-Type: multipart/form-data
Host: localhost:7272
User-Agent: HTTPie

--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="metadata"

{"catalog":"help"}
--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="file"; filename="10-dev-env.md"
Content-Type: 


--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="collection_ids"

["2cf8ceb6-1106-4c12-b233-7ef15cf74530","7a027464-a07c-4a04-9cbe-5976756791a8"]
--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="file-name"

10-dev-env.md
--PieBoundary123456789012345678901234567--

In the server side an error log like this:

ERROR - ingestion_workflow.py 178 : Error during assigning document to collection: invalid input for query argument $2: '2cf8ceb6-1106-4c12-b233-7ef15cf74530' (a sized iterable container expected (got type 'str'))

Additional context Add any other context about the problem here.

in the source file documents_router.py:

documents_router.py:
            workflow_input = {
                "file_data": file_data,
                "document_id": str(document_id),
                "collection_ids": (
                    [str(cid) for cid in collection_ids]
                    if collection_ids
                    else None
                ),

and in the file documents.py:

        ids = [id] if isinstance(id, UUID) else id

maybe should be

        ids = id if isinstance(id, list) else [id]

zhengwj533 avatar Mar 06 '25 03:03 zhengwj533