Skip to content

Bug: get_parameters_by_name returns {} instead of raising when GetParameters fails with raise_on_error=True #8586

Closed

Description

@leandrodamascena

Expected Behaviour

get_parameters_by_name(..., raise_on_error=True) (the default) raises GetParameterError when the GetParameters call fails. The docstring says: "Default to fail-fast. Raises GetParameterError upon any error".

Current Behaviour

When GetParameters fails with InvalidKeyId or InternalServerError, the except block in _get_parameters_by_name (ssm.py:633) turns the names into errors, but errors are only surfaced when raise_on_error=False. In fail-fast mode the function returns {} and the Lambda keeps running without its parameters. Same for an all-decrypt batch.

Code snippet

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

provider = SSMProvider(boto_config=Config(region_name="us-east-1"))
stub = Stubber(provider.client)
stub.add_client_error("get_parameters", "InvalidKeyId")
stub.activate()

print(provider.get_parameters_by_name({"/a": {}, "/b": {}}, raise_on_error=True))
# {}   expected: GetParameterError

Possible Solution

In the except of _get_parameters_by_name_from_batch (and the decrypt variant), if raise_on_error: raise GetParameterError(...) from exc before falling back to the error list. Add a test for both batches. Note for reviewers: code that treated the empty dict as "not found" will now see the exception, which is what the docstring always promised.

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.38.0 milestone on Oct 18, 2026
  2. leandrodamascena commented on Oct 19, 2026

    @leandrodamascena
    ContributorAuthor

    Hey @azmi2409 thanks, #8616 is yours. Will review.

  3. added a commit that references this issue on Oct 22, 2026
    51b1e49
  4. powertools-for-aws-oss-automation commented on Oct 22, 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. added
    pending-releaseFix or implementation already in dev waiting to be released
    and removed
    triagePending triage from maintainers
    on Oct 22, 2026
  6. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    This is now released under 3.38.0 version!

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

Metadata

Metadata

Assignees

No one assigned

    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