Open-EO / Open-EO/openeo-python-client

STAC Job Manager: item_id must be string

Open
#792 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

job manager
Dominant language
Python
Stars
217
Forks
56
Avg merge
1d 22h
Merged PRs (30d)
2

Description

I faced an issue recently where I got the following error when creating a STAC job database. The collection is created as expected, but there is an error when creating the item if a field named "item_id" is not available in my pandas dataframe.

Expecting HTTP status to be any of [200, 201, 202] but received 500 - Internal Server Error, request method=POST
response body:
{"code":"ValidationError","description":"1 validation error for Item\nid\n  Input should be a valid string [type=string_type, input_value=0, input_type=int]\n    For further information visit https://errors.pydantic.dev/2.11/v/string_type"}
Expecting HTTP status to be any of [200, 201, 202] but received 500 - Internal Server Error, request method=POST
response body:
{"code":"ValidationError","description":"1 validation error for Item\nid\n  Input should be a valid string [type=string_type, input_value=500, input_type=int]\n    For further information visit https://errors.pydantic.dev/2.11/v/string_type"}
Traceback (most recent call last):
  File "/data/users/Private/pratixa/nifi/cropsar_px_nifi/create_job_database.py", line 151, in <module>
    main()
  File "/data/users/Private/pratixa/nifi/cropsar_px_nifi/create_job_database.py", line 140, in main
    job_db.initialize_from_df(jobs_df, on_exists='error')
  File "/home/pratixa/.conda/envs/nifi/lib/python3.12/site-packages/openeo/extra/job_management/stac_job_db.py", line 106, in initialize_from_df
    self.persist(df)
  File "/home/pratixa/.conda/envs/nifi/lib/python3.12/site-packages/openeo/extra/job_management/stac_job_db.py", line 211, in persist
    self._upload_items_bulk(self.collection_id, all_items)
  File "/home/pratixa/.conda/envs/nifi/lib/python3.12/site-packages/openeo/extra/job_management/stac_job_db.py", line 247, in _upload_items_bulk
    self._ingest_bulk(chunk)
  File "/home/pratixa/.conda/envs/nifi/lib/python3.12/site-packages/openeo/extra/job_management/stac_job_db.py", line 230, in _ingest_bulk
    _check_response_status(response, _EXPECTED_STATUS_POST)
  File "/home/pratixa/.conda/envs/nifi/lib/python3.12/site-packages/openeo/extra/job_management/stac_job_db.py", line 311, in _check_response_status
    response.raise_for_status()
  File "/home/pratixa/.conda/envs/nifi/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://stac-api-dev.vgt.vito.be/collections/cropsar2d_jobdb_test05082025/bulk_items

In case the item_id is not available, it should consider the index as item_id, but then it would be an integer. https://github.com/Open-EO/openeo-python-client/blob/66499f9da31fb967411efb09e0ecd9075caf2e6f/openeo/extra/job_management/stac_job_db.py#L63

So, in this case, shouldn't we mention it to mandatorily have an item_id column that is string or shouldn't they we adapted to take it as string?

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 openeo/extra/job_management/stac_job_db.py at the linked line and trace initialize_from_df through persist and item upload. Compare the fallback index behavior with STAC Item's string ID requirement; done means the chosen policy is explicit and the item creation path no longer sends an integer ID.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.