Skip to content

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

Closed

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
    Contributor

    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

  4. powertools-for-aws-oss-automation commented on Oct 29, 2026

    @powertools-for-aws-oss-automation

    Warning

    This issue is now closed. Please be mindful that future comments are hard for our team to see.
    If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

  5. github-actions commented on Nov 3, 2026

    @github-actions
    Contributor

    This is now released under 3.39.0 version!

  6. removed
    pending-releaseFix or implementation already in dev waiting to be released
    on Nov 3, 2026
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 utility

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions