{"record":{"id":"181034051a9d1387","repo":"boto/boto3","slug":"search-path-hits-shape-type-shape-type-name-from","errorCode":null,"errorMessage":"Search path hits shape type {shape.type_name} from {item}","messagePattern":"Search path hits shape type (.+?) from (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"boto3/resources/response.py","lineNumber":112,"sourceCode":"    response = None\n\n    operation_model = service_model.operation_model(operation_name)\n    shape = operation_model.output_shape\n\n    if search_path:\n        # Walk the search path and find the final shape. For example, given\n        # a path of ``foo.bar[0].baz``, we first find the shape for ``foo``,\n        # then the shape for ``bar`` (ignoring the indexing), and finally\n        # the shape for ``baz``.\n        for item in search_path.split('.'):\n            item = item.strip('[0123456789]$')\n\n            if shape.type_name == 'structure':\n                shape = shape.members[item]\n            elif shape.type_name == 'list':\n                shape = shape.member\n            else:\n                raise NotImplementedError(\n                    f'Search path hits shape type {shape.type_name} from {item}'\n                )\n\n    # Anything not handled here is set to None\n    if shape.type_name == 'structure':\n        response = {}\n    elif shape.type_name == 'list':\n        response = []\n    elif shape.type_name == 'map':\n        response = {}\n\n    return response\n\n\nclass RawHandler:\n    \"\"\"\n    A raw action response handler. This passed through the response\n    dictionary, optionally after performing a JMESPath search if one","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/boto/boto3/blob/6e10b029c1326a437932a8b24f38af69fd986e15/boto3/resources/response.py#L94-L130","documentation":"Raised while constructing an empty placeholder response from a service model shape. The code walks the response `search_path` segment by segment and only knows how to descend into `structure` (via `.members`) and `list` (via `.member`) shapes. If a path segment lands on a `map`, scalar, or other shape type, the traversal cannot continue and NotImplementedError is raised. Like error 20, this is an internal model/shape mismatch rather than a user input problem.","triggerScenarios":"A resource model's `path` (e.g. `foo.bar[0].baz`) for a load/action references a member whose resolved shape is a `map` or a scalar, so `build_empty_response` cannot step into it. Surfaced when an operation returns an empty payload that boto3 must fill in from the model.","commonSituations":"A service API changed a member's shape type (e.g. structure→map) in a newer API version while the bundled boto3 resource model still references the old path; running boto3 with a botocore whose service definitions disagree with the resource models; corrupted install.","solutions":["Upgrade boto3 and botocore together to the latest release so service models and resource models agree.","If a specific API version is requested for the resource, drop the `api_version=` argument so boto3 picks the default, model-consistent version.","Reinstall boto3 cleanly (`pip install --force-reinstall boto3`) to rule out a corrupt data file.","Report the failing service + path to boto3 maintainers if it reproduces on a clean install of the latest version."],"exampleFix":"# before: pinning an old api_version that diverges from current shapes\nimport boto3\nsess = boto3.Session()\nsess.resource('s3', api_version='2006-03-01')  # path may hit a changed shape\n\n# after: omit api_version to let boto3 resolve a consistent pair\nsess.resource('s3')","handlingStrategy":"type-guard","validationCode":"import boto3\n# Validate api_version against available versions before use\nsvc = 's3'\nloader = boto3.session.Session()._loader\nversions = loader.list_api_versions(svc, 'resources-1')\n# then call resource without forcing an unsupported api_version","typeGuard":"def supported_resource_api(session, service, requested=None):\n    versions = session._loader.list_api_versions(service, 'resources-1')\n    if requested and requested not in versions:\n        return None  # let boto3 pick default\n    return requested or versions[-1]","tryCatchPattern":"try:\n    res = sess.resource('s3')\nexcept NotImplementedError:\n    res = sess.resource('s3')  # drop api_version and retry; or upgrade","preventionTips":["Avoid pinning resource api_version unless required; let boto3 choose.","Upgrade boto3/botocore together so shapes and resource paths agree.","Smoke-test each resource you depend on after dependency updates."],"tags":["resource-model","shape","internal","version-mismatch"],"backgroundTag":null,"analyzedSha":"6e10b029c1326a437932a8b24f38af69fd986e15","analyzedAt":"2026-08-11T20:52:47.213Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}