api icon indicating copy to clipboard operation
api copied to clipboard

[Bug or New restriction]: exclude_elements - String should have at most 15 characters

Open JiaoyueYuan opened this issue 1 year ago • 3 comments

I have a list of ~20 elements that need to be excluded in MP query. The code worked fine on Dec 1st, but failed with this error on Dec 11th:

mp_api.client.core.client.MPRestError: REST query returned with error status code 422 on URL ... with message:
exclude_elements - String should have at most 15 characters

Any query with exclude_elements length > 15 characters (including comma) would result in the same error. eg,.

from mp_api.client import MPRester
from emmet.core.summary import HasProps

with MPRester("your_api_key") as mpr:
    exclude_eles = ["H", "Rb", "Cs", "Be", 
                    "Mn", "Tc", "Re", "Fe", 
                    "Ru", "Os", "Co", "Rh",
                    "Ir", "Ni", "Pd", "Pt",
                    "Ag", "Au", "Cd", "Hg"]

    docs = mpr.summary.search(num_elements=3, 
                              is_gap_direct=True,
                              exclude_elements=exclude_eles,
                              has_props=[HasProps.bandstructure],
                              fields=["material_id"])

I am wondering if this is a new restriction or a bug.

JiaoyueYuan avatar Dec 12 '23 02:12 JiaoyueYuan

This is a new restriction for the time being while we address some performance issues with our infrastructure.

munrojm avatar Dec 13 '23 19:12 munrojm

I am encountering the same error. Can you please tell when are you going to remove this restriction?

Shibu778 avatar Mar 03 '24 11:03 Shibu778

Bumping this to ask if there's a timeline for removing the exclude_elements length restriction!

ebanyas avatar Sep 26 '24 16:09 ebanyas

We still need to keep some level of restriction on the list length in place but I raised it to 60 characters with the deployment a few days ago. That should allow @JiaoyueYuan 's original request through. HTH

tschaume avatar Sep 30 '24 16:09 tschaume