boto/boto3 · error · UnknownAPIVersionError
The ' ' resource does not support an API version of: Valid…
Error message
The '{service_name}' resource does not support an API version of: {bad_api_version}
Valid API versions are: {available_api_versions} What it means
`UnknownAPIVersionError` is raised when `Session.resource(service_name, api_version=...)` references an API version that has no `resources-1` data file for that service. boto3 lists the valid versions in the message. This happens because a resource model exists for the service, but not for the specific (often outdated or forward-dated) version you requested. Note that resource API versions and client API versions can legitimately differ, so pinning requires care.
Solutions
- Omit `api_version` to let boto3 select the latest supported resource version.
- Pick a version from the message's `available_api_versions` list (e.g. via `boto3.session.Session()._loader.list_api_versions(name, 'resources-1')`).
- Upgrade boto3 — newer versions add more API version files.
- Reinstall boto3 if a version that should exist is missing (corrupt install).
Example fix
# before
boto3.resource('s3', api_version='2004-01-01') # UnknownAPIVersionError
# after
boto3.resource('s3') # latest resource API version
# or pick from the listed valid versions, e.g.
boto3.resource('s3', api_version='2006-03-01') Defensive patterns
Strategy: validation
Validate before calling
def safe_resource(session, service, api_version=None):
versions = session._loader.list_api_versions(service, 'resources-1')
if api_version and api_version not in versions:
api_version = None # let boto3 pick the latest
return session.resource(service, api_version=api_version) Type guard
def api_version_supported(session, service, version) -> bool:
return version in session._loader.list_api_versions(service, 'resources-1') Try / catch
from boto3.exceptions import UnknownAPIVersionError
try:
res = session.resource(service, api_version=v)
except UnknownAPIVersionError:
res = session.resource(service) # default latest Prevention
- Avoid pinning api_version for resources unless reproducibility requires it.
- Source valid versions from list_api_versions(service, 'resources-1').
- Upgrade boto3 to gain newer resource API version files.
When it happens
Trigger: Calling `boto3.resource('s3', api_version='2004-01-01')` (a version with no resource data) or `api_version='2099-01-01'` (does not exist); pinning to a version copied from a different service's docs; using a version string that is a client-only API version.
Common situations: Hard-coding an old api_version for reproducibility that predates the resource model; mistyping the date format; environment with a partial boto3 install missing some version files.
Related errors
- The ' ' resource does not exist. The available resources…
- Unable to locate credentials
- Either a boto3.Client or s3transfer.manager.TransferManager…
- Filename must be a string or a path-like object
- Manager cannot be provided with client, config, nor osutil…
AI-assisted analysis of boto/boto3@6e10b029c1 (2026-08-11).
Data as JSON: /api/errors/0f4defdda727d7ff.
Report an issue: GitHub.
Appendix: source
Thrown at boto3/session.py:441
"""
try:
resource_model = self._loader.load_service_model(
service_name, 'resources-1', api_version
)
except UnknownServiceError:
available = self.get_available_resources()
has_low_level_client = (
service_name in self.get_available_services()
)
raise ResourceNotExistsError(
service_name, available, has_low_level_client
)
except DataNotFoundError:
# This is because we've provided an invalid API version.
available_api_versions = self._loader.list_api_versions(
service_name, 'resources-1'
)
raise UnknownAPIVersionError(
service_name, api_version, ', '.join(available_api_versions)
)
if api_version is None:
# Even though botocore's load_service_model() can handle
# using the latest api_version if not provided, we need
# to track this api_version in boto3 in order to ensure
# we're pairing a resource model with a client model
# of the same API version. It's possible for the latest
# API version of a resource model in boto3 to not be
# the same API version as a service model in botocore.
# So we need to look up the api_version if one is not
# provided to ensure we load the same API version of the
# client.
#
# Note: This is relying on the fact that
# loader.load_service_model(..., api_version=None)
# and loader.determine_latest_version(..., 'resources-1')View on GitHub (pinned to 6e10b029c1)