This repository was archived by the owner on Nov 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
This repository was archived by the owner on Nov 29, 2025. It is now read-only.
Pagination fails if long list passed to filter value #872
Copy link
Copy link
Open
Labels
buguse for describing something not working as expecteduse for describing something not working as expected
Milestone
Description
Description
Pagination fails when I pass a long list to the values key in a filter passed to filters.
Environment
- OS (where OpenCTI server runs): AWS Amazon Linux
- OpenCTI version: 6.2.18
- Other environment details: Using Amazon OpenSearch
Reproducible Steps
Run this script, changing what's needed:
client = OpenCTIApiClient() # init your client
custom_attributes = """id"""
filters = {
"mode": "and",
"filters": [
{"key":"creator_id","values":["<creator id>"]},
],
"filterGroups": [],
}
result = client.stix_cyber_observable.list(
getAll=True,
customAttributes=custom_attributes,
filters=filters
)
observable_ids = [observable["id"] for observable in result]
custom_attributes = """id"""
filters = {
"mode": "and",
"filters": [
{"key": "report_types", "values": "<custom-report-type>"},
{"key": "objects", "values": observable_ids, "operator": "eq", "mode": "or"}
],
"filterGroups": [],
}
result = client.report.list(
getAll=True,
customAttributes=custom_attributes,
filters=filters
)
print(f"Got {len(result)} reports!")
When I run this in our production instance, I get 100,820 results from the call to client.stix_cyber_observable.list, which is then passed to the filters in the call to client.report.list, which is where the exception is thrown. I suspect it has something to do with the length of this list because when I comment out the getAll param in the call to client.stix_cyber_observable.list, which gives me only 100 results, I get the expected output with no error.
Expected Output
I expect to get the number of reports that meet my criteria.
Actual Output
Traceback (most recent call last):
File "my_script.py", line 42, in <module>
result = client.report.list(
^^^^^^^^^^^^^^^^^^^
File "/path/to/.venv/lib/python3.12/site-packages/pycti/entities/opencti_report.py", line 538, in list
result = self.opencti.query(
^^^^^^^^^^^^^^^^^^^
File "/path/to/.venv/lib/python3.12/site-packages/pycti/api/opencti_api_client.py", line 384, in query
raise ValueError(value_error)
ValueError: {'name': 'DATABASE_ERROR', 'error_message': 'Fail to execute engine pagination'}
Metadata
Metadata
Assignees
Labels
buguse for describing something not working as expecteduse for describing something not working as expected