Skip to content

Bug: DynamoDBProvider and AppConfigProvider surface bare KeyError text as the error message #8601

Open

Description

@leandrodamascena

Expected Behaviour

Error messages explain what went wrong: for example Parameter 'nope' not found in table 't'.

Current Behaviour

Three places let a KeyError propagate and GetParameterError ends up with the raw key as its message: dynamodb.py:205 ('Item' when the item does not exist), dynamodb.py:233 ('sk' when an item lacks the sort attribute), appconfig.py:148 ('cfg' when the first get_latest_configuration returns an empty Configuration, for example a profile never deployed).

Code snippet

from botocore.config import Config
from botocore.stub import Stubber
from aws_lambda_powertools.utilities.parameters import DynamoDBProvider

provider = DynamoDBProvider(table_name="t", config=Config(region_name="us-east-1"))
stub = Stubber(provider.table.meta.client)
stub.add_response("get_item", {}, None)
stub.activate()

provider.get("nope")  # GetParameterError: 'Item'   expected a message that names the parameter and table

Possible Solution

Check for the missing keys explicitly and raise GetParameterError with a descriptive message in the three places.

Steps to Reproduce

Run the snippet above (it uses botocore.stub.Stubber, no AWS access needed).

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.13

Packaging format used

PyPi

Debugging logs

Warning

This issue is ready to be picked up, by humans or by agents. If you want it, comment here first so we can assign it to you, and please take only one or two issues at a time so others can join in too. The reproduction above runs locally without AWS access. Thanks!

Activity

  1. added this to the 3.39.0 milestone on Oct 18, 2026
  2. kudala-bharani commented on Oct 18, 2026

    @kudala-bharani

    Could I take this one? I'll add descriptive errors for the three missing-data cases and regression tests that run without AWS access.

  3. leandrodamascena commented on Oct 18, 2026

    @leandrodamascena
    ContributorAuthor

    Pls go ahead @kudala-bharani

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workinggood first issueGood for newcomersparametersParameters utilitytriagePending triage from maintainers

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions