Skip to content

diff: unexpected error - 'ClientCreatorContext' object has no attribute 'create_token' #9623

@Taytay

Description

@Taytay

Bug Report

[Issue name](diff: unexpected error - 'ClientCreatorContext' object has no attribute 'create_token')

Description

I cloned a repo that has DVC configured in it to my local machine. I ran my first dvc command that required access to the remote, and instead of giving me a nice Unable to find credentials that the troubleshooting guide recommended, I got a confusing exception AttributeError: 'ClientCreatorContext' object has no attribute 'create_token'. See below for the full stack trace.

It turns out that I needed to set my remote S3 credentials using config.local. This makes sense that I'd need to set that up, but I was surprised that the error message was so cryptic.

dvc diff                                                                                                                              ─╯
Refreshing token failed during the mandatory refresh period.
Traceback (most recent call last):
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 65, in
_protected_refresh
    self._frozen_token = await self._refresh_using()
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 142, in
_refresher
    new_token_dict = await self._refresh_access_token(token_dict)
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 127, in
_refresh_access_token
    return await self._attempt_create_token(token)
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 86, in
_attempt_create_token
    response = await self._client.create_token(
AttributeError: 'ClientCreatorContext' object has no attribute 'create_token'
Refreshing temporary credentials failed during mandatory refresh period.
Traceback (most recent call last):
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/credentials.py", line 327,
in _protected_refresh
    metadata = await self._refresh_using()
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/credentials.py", line 385,
in fetch_credentials
    return await self._get_cached_credentials()
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/credentials.py", line 395,
in _get_cached_credentials
    response = await self._get_credentials()
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/credentials.py", line 1025,
in _get_credentials
    token = (await initial_token_data.get_frozen_token()).token
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 40, in
get_frozen_token
    await self._refresh()
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 53, in
_refresh
    await self._protected_refresh()
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 65, in
_protected_refresh
    self._frozen_token = await self._refresh_using()
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 142, in
_refresher
    new_token_dict = await self._refresh_access_token(token_dict)
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 127, in
_refresh_access_token
    return await self._attempt_create_token(token)
  File "project_folder/env/lib/python3.10/site-packages/aiobotocore/tokens.py", line 86, in
_attempt_create_token
    response = await self._client.create_token(
AttributeError: 'ClientCreatorContext' object has no attribute 'create_token'
ERROR: unexpected error - 'ClientCreatorContext' object has no attribute 'create_token'

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
sys:1: RuntimeWarning: coroutine 'AioSession._create_client' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Reproduce

Run a command that requires access to the remote storage, but forget to set the config.local credentials.

Expected

Straightforward error message.

Environment information

Output of dvc doctor:

In the environment that works:

DVC version: 3.0.0 (pip)
------------------------
Platform: Python 3.11.2 on macOS-12.6-arm64-arm-64bit
Subprojects:
	dvc_data = 1.11.0
	dvc_objects = 0.23.0
	dvc_render = 0.5.3
	dvc_task = 0.3.0
	scmrepo = 1.0.3
Supports:
	http (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
	https (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
	s3 (s3fs = 2023.6.0, boto3 = 1.26.76)
Config:
	Global: /Users/taytay/Library/Application Support/dvc
	System: /Library/Application Support/dvc
Cache types: reflink, hardlink, symlink
Cache directory: apfs on /dev/disk3s1s1
Caches: local
Remotes: s3
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git
Repo.site_cache_dir: /Library/Caches/dvc/repo/421e053060dadb20df81a448aaccef85

That doesn't work:

dvc doctor                                                                                                                            ─╯
DVC version: 3.0.0 (pip)
------------------------
Platform: Python 3.11.2 on macOS-12.6-arm64-arm-64bit
Subprojects:
	dvc_data = 1.11.0
	dvc_objects = 0.23.0
	dvc_render = 0.5.3
	dvc_task = 0.3.0
	scmrepo = 1.0.3
Supports:
	http (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
	https (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
	s3 (s3fs = 2023.6.0, boto3 = 1.26.76)
Config:
	Global: /Users/taytay/Library/Application Support/dvc
	System: /Library/Application Support/dvc
Cache types: <https://error.dvc.org/no-dvc-cache>
Caches: local
Remotes: s3
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git
Repo.site_cache_dir: /Library/Caches/dvc/repo/35ef123111fdc1971ff1bed3cbd42748

Metadata

Metadata

Assignees

No one assigned

    Labels

    A: data-syncRelated to dvc get/fetch/import/pull/pushp2-mediumMedium priority, should be done, but less importantuiuser interface / interaction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions