Skip to content

Bug: sam sync nested_stack_manager.py: collections.OrderedDict' object has no attribute 'append' #8148

@whenceforth

Description

@whenceforth

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"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions