Repository navigation
Bug: sam sync nested_stack_manager.py: collections.OrderedDict' object has no attribute 'append' #8148
Copy link
Copy link
Closed
Labels
area/intrinsicsRef, If, Sub, GetAtt, ...Ref, If, Sub, GetAtt, ...area/layersblocked/more-info-neededMore info is needed from the requester. If no response in 14 days, it will become stale.More info is needed from the requester. If no response in 14 days, it will become stale.stage/prHas a PR ready for reviewHas a PR ready for review
Description
Description:
Running sam sync and it fails when it tries to call append on an OrderedDict
Steps to reproduce:
Observed result:
ran with --debug, but I've removed most of the output to avoid sharing non-public information.
025-07-01 18:43:44,735 | Auto creating dependency layer for each function resource into a nested stack
2025-07-01 18:43:44,736 | 7 resources found in the stack StackDataSync
2025-07-01 18:43:44,736 | Found Serverless function with name='DataSyncFunction' and CodeUri='../../dist/data-sync'
2025-07-01 18:43:44,736 | --base-dir is not presented, adjusting uri ../../dist/data-sync relative to
/Users/artpeel/code/vg/customer-service/apps/data-sync/template.yml
2025-07-01 18:43:44,738 | 7 resources found in the stack StackDataSync
2025-07-01 18:43:44,738 | Found Serverless function with name='DataSyncFunction' and CodeUri='../../dist/data-sync'
2025-07-01 18:43:44,743 | There is no customer defined id or cdk path defined for resource BPIEventsQueue, so we will use the
resource logical id as the resource id
2025-07-01 18:43:44,743 | There is no customer defined id or cdk path defined for resource BPIEventsDLQ, so we will use the resource
logical id as the resource id
2025-07-01 18:43:44,744 | There is no customer defined id or cdk path defined for resource BPIEventsFunction, so we will use the
resource logical id as the resource id
2025-07-01 18:43:44,744 | Auto creating dependency layer for each function resource into a nested stack
2025-07-01 18:43:44,745 | 3 resources found in the stack StackEvents
2025-07-01 18:43:44,745 | Found Serverless function with name='BPIEventsFunction' and CodeUri='../../dist/events/src/handlers'
2025-07-01 18:43:44,745 | --base-dir is not presented, adjusting uri ../../dist/events/src/handlers relative to
/Users/artpeel/code/vg/customer-service/apps/events/template.yml
2025-07-01 18:43:44,746 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2025-07-01 18:43:44,747 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2025-07-01 18:43:44,747 | Unable to find Click Context for getting session_id.
Error: 'collections.OrderedDict' object has no attribute 'append'
Traceback:
File "click/core.py", line 1082, in main
File "click/core.py", line 1697, in invoke
File "click/core.py", line 1443, in invoke
File "click/core.py", line 788, in invoke
File "samcli/cli/cli_config_file.py", line 347, in wrapper
File "click/decorators.py", line 92, in new_func
File "click/core.py", line 788, in invoke
File "samcli/lib/telemetry/metric.py", line 185, in wrapped
File "samcli/lib/telemetry/metric.py", line 150, in wrapped
File "samcli/lib/telemetry/event.py", line 376, in wrapped
File "samcli/lib/telemetry/event.py", line 368, in wrapped
File "samcli/lib/cli_validation/image_repository_validation.py", line 111, in wrapped
File "samcli/lib/telemetry/metric.py", line 104, in wrapped
File "samcli/lib/utils/version_checker.py", line 43, in wrapped
File "samcli/cli/main.py", line 95, in wrapper
File "samcli/commands/_utils/cdk_support_decorators.py", line 40, in wrapped
File "samcli/commands/_utils/command_exception_handler.py", line 89, in wrapper_command_exception_handler
File "samcli/commands/_utils/command_exception_handler.py", line 69, in wrapper_command_exception_handler
File "samcli/commands/sync/command.py", line 229, in cli
File "samcli/commands/sync/command.py", line 432, in do_cli
File "samcli/commands/sync/command.py", line 475, in execute_infra_contexts
File "samcli/lib/sync/infra_sync_executor.py", line 169, in execute_infra_sync
File "samcli/commands/build/build_context.py", line 291, in run
File "samcli/commands/build/build_context.py", line 397, in _handle_build_post_processing
File "samcli/lib/bootstrap/nested_stack/nested_stack_manager.py", line 103, in generate_auto_dependency_layer_stack
File "samcli/lib/bootstrap/nested_stack/nested_stack_manager.py", line 131, in _add_layer
An unexpected error was encountered while executing "sam sync".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20sync%20-%20AttributeError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20sync%20-%20AttributeError
Expected result:
The stack to be created
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
{
"version": "1.142.1",
"system": {
"python": "3.11.10",
"os": "macOS-15.5-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "27.4.0",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_PACKAGE_PERFORMANCE",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/intrinsicsRef, If, Sub, GetAtt, ...Ref, If, Sub, GetAtt, ...area/layersblocked/more-info-neededMore info is needed from the requester. If no response in 14 days, it will become stale.More info is needed from the requester. If no response in 14 days, it will become stale.stage/prHas a PR ready for reviewHas a PR ready for review
Activity
roger-zhangg commentedon Sep 3, 2026
Following up on this one — apologies it has sat for so long.
To move it forward I need a bit more than the log excerpt. The Steps to reproduce section is empty, and the traceback frame itself was trimmed out of the pasted
--debugoutput, so I can't tell which.append()call on anOrderedDictis failing insidenested_stack_manager.py.Could you provide:
template.ymlthat reproduces it — the debug output shows--dependency-layerauto-layer creation running over a stack with 7 resources includingDataSyncFunction,BPIEventsQueue,BPIEventsDLQ,BPIEventsFunction. The part I most need is howLayersis declared on the failing function. A likely trigger isLayersgiven via an intrinsic (e.g.!If/!Ref) rather than a plain list, in which case the auto-dependency-layer code appends to something that isn't a list.sam synccommand andsam --version.Worth noting: #8489 ("fix(sync): Skip auto-dependency layer for functions with intrinsic function Layers") is open and may already address this exact case. If your template declares
Layerswith an intrinsic function, that PR is likely your fix — confirming that from your template would let us link the two and close this out.Marking as
blocked/more-info-neededin the meantime.whenceforth commentedon Sep 4, 2026
we are no longer using sam stack
github-actions commentedon Sep 4, 2026
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.