Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError on graph_client.planner.plans.by_planner_plan_id(planId).tasks.get() #1057

Open
tommeer opened this issue Jan 10, 2025 · 0 comments
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@tommeer
Copy link

tommeer commented Jan 10, 2025

Describe the bug

I get an occasional string index out of range error when calling the function graph_client.planner.plans.by_planner_plan_id(planId).tasks.get().
I ran it against 109 plans and i was able to retrieve 90 succesful. The failed ones retrieved fine when using Graph Explorer.

I'm running the following code:

import asyncio
import configparser
from azure.identity.aio import ClientSecretCredential
from msgraph.graph_service_client import GraphServiceClient

async def main():
    config = configparser.ConfigParser()
    config.read(['config.cfg', 'config.dev.cfg'])

    credentials = ClientSecretCredential(
        config.get('azure','tenantId'),
        config.get('azure','clientId'),
        config.get('azure','clientSecret'),
    )
    scopes = ['https://graph.microsoft.com/.default']

    graph_client = GraphServiceClient(credentials, scopes)
    planId = config.get('app','planId')
    result = await graph_client.planner.plans.by_planner_plan_id(planId).tasks.get()

asyncio.run(main())

Expected behavior

Returned data just like other plans that do seem to work.
Also running the same plan ID in Graph Explorer gives the expected output.

How to reproduce

I ran the the following code and it fails always on the same plan id's.

import asyncio
import configparser
from azure.identity.aio import ClientSecretCredential
from msgraph.graph_service_client import GraphServiceClient

async def main():
    config = configparser.ConfigParser()
    config.read(['config.cfg', 'config.dev.cfg'])

    credentials = ClientSecretCredential(
        config.get('azure','tenantId'),
        config.get('azure','clientId'),
        config.get('azure','clientSecret'),
    )
    scopes = ['https://graph.microsoft.com/.default']

    graph_client = GraphServiceClient(credentials, scopes)
    planId = config.get('app','planId')
    result = await graph_client.planner.plans.by_planner_plan_id(planId).tasks.get()

asyncio.run(main())

SDK Version

1.16.0

Latest version known to work for scenario above?

No response

Known Workarounds

None found yet

Debug output

Click to expand log ```

Traceback (most recent call last):
File "d:\Software_Python\graph-user-auth-tutorial\tasktest.py", line 21, in
asyncio.run(main())
~~~~~~~~~~~^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 720, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "d:\Software_Python\graph-user-auth-tutorial\tasktest.py", line 19, in main
result = await graph_client.planner.plans.by_planner_plan_id(planId).tasks.get()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\msgraph\generated\planner\plans\item\tasks\tasks_request_builder.py", line 68, in get
return await self.request_adapter.send_async(request_info, PlannerTaskCollectionResponse, error_mapping)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_http\httpx_request_adapter.py", line 196, in send_async
value = root_node.get_object_value(parsable_factory)
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 222, in get_object_value
self._assign_field_values(result)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 291, in _assign_field_values
field_deserializer(JsonParseNode(field_value))
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\msgraph\generated\models\planner_task_collection_response.py", line 40, in
"value": lambda n : setattr(self, 'value', n.get_collection_of_object_values(PlannerTask)),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 170, in get_collection_of_object_values
return list(
map(
...<2 lines>...
)
)
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 172, in
lambda x: self._create_new_node(x).get_object_value(factory), # type: ignore
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 222, in get_object_value
self._assign_field_values(result)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 291, in _assign_field_values
field_deserializer(JsonParseNode(field_value))
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\msgraph\generated\models\planner_task.py", line 116, in
"assignments": lambda n : setattr(self, 'assignments', n.get_object_value(PlannerAssignments)),
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 222, in get_object_value
self._assign_field_values(result)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 293, in _assign_field_values
item_additional_data[field_name] = self.try_get_anything(field_value)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 310, in try_get_anything
return dict(map(lambda x: (x[0], self.try_get_anything(x[1])), value.items()))
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 310, in
return dict(map(lambda x: (x[0], self.try_get_anything(x[1])), value.items()))
~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\kiota_serialization_json\json_parse_node.py", line 317, in try_get_anything
datetime_obj = pendulum.parse(value)
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pendulum\parser.py", line 30, in parse
return _parse(text, **options)
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pendulum\parser.py", line 43, in parse
parsed = base_parse(text, **options)
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pendulum\parsing_init
.py", line 78, in parse
return _normalize(_parse(text, **_options), **options)
~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pendulum\parsing_init
.py", line 116, in _parse
return parse_iso8601_interval(text)
File "C:\Users<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pendulum\parsing_init
.py", line 221, in _parse_iso8601_interval
elif last[0] == "P":
~~~~^^^
IndexError: string index out of range

</details>


### Configuration

- OS: Windows 11
- Arch: x64
- Python version: 3.13.1 64-bit (Microsoft Store)

### Other information

_No response_
@tommeer tommeer added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

1 participant