Skip to content

Bug: sam init - CalledProcessError #7929

Closed as not planned
Closed as not planned

Description

@odxkamimoto

Description:

sam init --location git+ssh://git@github.com/my_org/my_repo.git failed with the following error.

2025-03-11 15:59:50 git clone failed with error: Cloning into 'odx-eq-lambda-aws-sam-python'...
OpenSSL version mismatch. Built against 30000020, you have 30300010
fatal: Could not read from remote repository.

Steps to reproduce:

  1. Create github repository and template with following structure:
❯ tree
.
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── cookiecutter.json
├── hooks
│   └── post_gen_project
└── {{cookiecutter.project_name}}
    ├── Makefile
    ├── Pipfile
    ├── README.md
    ├── buildspec.yaml
    ├── events
    │   └── testevent.json
    ├── function
    │   ├── __init__.py
    │   └── requirements.txt
    ├── samconfig.toml
    ├── template.yaml
    └── tests
        ├── __init__.py
        ├── conftest.py
        └── unit
            ├── __init__.py
            └── test_hello_function.py
			
  1. Run the command 'sam init --location git+ssh://git@github.com/my_org/my_repo.git'

Observed result:

2025-03-11 15:45:20 git clone failed with error: Cloning into 'my_repo'...
OpenSSL version mismatch. Built against 30000020, you have 30300010
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Error: Command '['git', 'clone', 'ssh://git@github.com/my_org/my_repo.git']' returned non-zero exit status 128.
Traceback:
File "click/core.py", line 1078, in main
File "click/core.py", line 1688, in invoke
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "samcli/cli/cli_config_file.py", line 347, in wrapper
File "samcli/commands/init/command.py", line 103, in wrapped
File "click/decorators.py", line 92, in new_func
File "click/core.py", line 783, 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/utils/version_checker.py", line 43, in wrapped
File "samcli/cli/main.py", line 95, in wrapper
File "samcli/commands/init/command.py", line 266, in cli
File "samcli/commands/init/command.py", line 347, in do_cli
File "samcli/commands/init/init_generator.py", line 24, in do_generate
File "samcli/lib/init/init.py", line 112, in generate_project
File "cookiecutter/main.py", line 80, in cookiecutter
File "cookiecutter/repository.py", line 108, in determine_repo_dir
File "cookiecutter/vcs.py", line 105, in clone
File "subprocess.py", line 466, in check_output
File "subprocess.py", line 571, in run

An unexpected error was encountered while executing "sam init".
Search for an existing issue:

Expected result:

sam init completes successfully and the project directory is created.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Ubuntu 22.04(wsl)
  2. sam --version: SAM CLI, version 1.134.0
  3. AWS region: ap-northeast-1
# Paste the output of `sam --info` here

{
"version": "1.134.0",
"system": {
"python": "3.11.10",
"os": "Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35"
},
"additional_dependencies": {
"docker_engine": "27.5.1",
"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_RUST_CARGO_LAMBDA"
]
}

Add --debug flag to command you are running

Same as the above results.

We have also confirmed that we can successfully clone from GitHub with the following command.

git clone git+ssh://git@github.com/my_org/my_repo.git

Also, the project is successfully created from CodeCommit's repository with the same contents.

Activity

  1. added
    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.
    on Mar 11, 2025
  2. vicheey commented on Mar 28, 2025

    @vicheey
    Contributor

    Thank you for reaching out. This is likely because of the permission that SAM CLI uses to get the package. I'll take a look.

  3. added and removed
    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.
    on Mar 29, 2025
  4. vicheey commented on Mar 29, 2025

    @vicheey
    Contributor

    I was not able to reproduce the issue using my private repo. Please let me know if there is any

    sam --version
    SAM CLI, version 1.134.0
    
    sam init --location git+ssh://git@github.com/vicheey/CookieCutterSamSampleProjects.git
      [1/1] project_name (aws_sam_ocr): 
    
  5. wikeegan commented on May 2, 2025

    @wikeegan

    I have been running into this same issue. Initially via a Codebuild stage, but was able to fix that by updating the image from Ubuntu to Amazon Linux. Issue started to appear late last year, and was stable for a few years before then.

    Currently getting the issue now locally when running sam build, but have also been able to reproduce the OP issue with sam init. Please see below

    Sam init Issue

    sam init --location git@github.com:XXXX/ada-cloud-template-repo.git
    
    2025-05-02 18:45:46 git clone failed with error: Cloning into 'ada-cloud-template-repo'...
    OpenSSL version mismatch. Built against 30000020, you have 30300030
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
    
    Error: Command '['git', 'clone', 'git@github.com:XXXX/ada-cloud-template-repo.git']' returned non-zero exit status 128.
    Traceback:
      File "click/core.py", line 1078, in main
      File "click/core.py", line 1688, in invoke
      File "click/core.py", line 1434, in invoke
      File "click/core.py", line 783, in invoke
      File "samcli/cli/cli_config_file.py", line 347, in wrapper
      File "samcli/commands/init/command.py", line 103, in wrapped
      File "click/decorators.py", line 92, in new_func
      File "click/core.py", line 783, 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/utils/version_checker.py", line 43, in wrapped
      File "samcli/cli/main.py", line 95, in wrapper
      File "samcli/commands/init/command.py", line 266, in cli
      File "samcli/commands/init/command.py", line 347, in do_cli
      File "samcli/commands/init/init_generator.py", line 24, in do_generate
      File "samcli/lib/init/__init__.py", line 112, in generate_project
      File "cookiecutter/main.py", line 80, in cookiecutter
      File "cookiecutter/repository.py", line 108, in determine_repo_dir
      File "cookiecutter/vcs.py", line 105, in clone
      File "subprocess.py", line 466, in check_output
      File "subprocess.py", line 571, in run
    

    Sam build Issue

    sam build
    
    Building codeuri: /home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send runtime: nodejs22.x       
    architecture: x86_64 functions: OndemandSend                                                                    
     Running NodejsNpmEsbuildBuilder:CopySource                                                                     
     Running NodejsNpmEsbuildBuilder:NpmInstall                                                                     
    
    Build Failed
    Error: NodejsNpmEsbuildBuilder:NpmInstall - NPM Failed: npm warn Unknown cli config "--unsafe-perm". This will stop working in the next major version of npm.
    npm warn config production Use `--omit=dev` instead.
    npm warn deprecated @aws-lambda-powertools/tracer@1.18.1: Version 1.x has reached End-of-Life, please upgrade to 2.x, more info here: https://s12d.com/upgrade-v2
    npm warn deprecated @aws-lambda-powertools/logger@1.18.1: Version 1.x has reached End-of-Life, please upgrade to 2.x, more info here: https://s12d.com/upgrade-v2
    npm warn deprecated @aws-lambda-powertools/commons@1.18.1: Version 1.x has reached End-of-Life, please upgrade to 2.x, more info here: https://s12d.com/upgrade-v2
    npm error code 128
    npm error An unknown git error occurred
    npm error command git --no-replace-objects ls-remote ssh://git@github.com/XXXX/ada-common-lib.git
    npm error OpenSSL version mismatch. Built against 30000020, you have 30300030
    npm error fatal: Could not read from remote repository.
    npm error
    npm error Please make sure you have the correct access rights
    npm error and the repository exists.
    npm error A complete log of this run can be found in: /home/billy/.npm/_logs/2025-05-02T22_53_33_009Z-debug-0.log
    

    Truncated Debug logs

    2025-05-02 18:56:22,137 | Running workflow 'NodejsNpmEsbuildBuilder'                                            
    2025-05-02 18:56:22,137 |  Running NodejsNpmEsbuildBuilder:CopySource                                           
    2025-05-02 18:56:22,138 | Copying source file                                                                   
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/package-lock.json) to destination          
    (/tmp/tmpqeqd868j/package-lock.json)                                                                            
    2025-05-02 18:56:22,139 | Copying source file                                                                   
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/schema.json) to destination                
    (/tmp/tmpqeqd868j/schema.json)                                                                                  
    2025-05-02 18:56:22,139 | Copying source file                                                                   
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/package.json) to destination               
    (/tmp/tmpqeqd868j/package.json)                                                                                 
    2025-05-02 18:56:22,140 | Copying source file                                                                   
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/OnDemandRequest.d.ts) to destination       
    (/tmp/tmpqeqd868j/OnDemandRequest.d.ts)                                                                         
    2025-05-02 18:56:22,141 | Copying source file                                                                   
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/index.ts) to destination                   
    (/tmp/tmpqeqd868j/index.ts)                                                                                     
    2025-05-02 18:56:22,141 | Creating target folders at /tmp/tmpqeqd868j/test                                      
    2025-05-02 18:56:22,142 | Copying directory metadata from source                                                
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/test) to destination                       
    (/tmp/tmpqeqd868j/test)                                                                                         
    2025-05-02 18:56:22,143 | Creating target folders at /tmp/tmpqeqd868j/test/unit                                 
    2025-05-02 18:56:22,143 | Copying directory metadata from source                                                
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/test/unit) to destination                  
    (/tmp/tmpqeqd868j/test/unit)                                                                                    
    2025-05-02 18:56:22,144 | Copying source file                                                                   
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/test/unit/ondemand-send.test.ts) to        
    destination (/tmp/tmpqeqd868j/test/unit/ondemand-send.test.ts)                                                  
    2025-05-02 18:56:22,144 | Creating target folders at /tmp/tmpqeqd868j/test/integration                          
    2025-05-02 18:56:22,145 | Copying directory metadata from source                                                
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/test/integration) to destination           
    (/tmp/tmpqeqd868j/test/integration)                                                                             
    2025-05-02 18:56:22,145 | Copying source file                                                                   
    (/home/billy/Documents/Projects/ada-vins-api/functions/ondemand-send/test/integration/ondemand-send.test.ts) to 
    destination (/tmp/tmpqeqd868j/test/integration/ondemand-send.test.ts)                                           
    2025-05-02 18:56:22,146 | NodejsNpmEsbuildBuilder:CopySource succeeded                                          
    2025-05-02 18:56:22,146 |  Running NodejsNpmEsbuildBuilder:NpmInstall                                           
    2025-05-02 18:56:22,147 | NODEJS installing production dependencies in: /tmp/tmpqeqd868j                        
    2025-05-02 18:56:22,147 | executing NPM: ['npm', 'install', '-q', '--no-audit', '--no-save', '--unsafe-perm',   
    '--production']                                                                                                 
    2025-05-02 18:56:25,558 | NodejsNpmEsbuildBuilder:NpmInstall failed                                             
    Traceback (most recent call last):                                                                              
      File "aws_lambda_builders/workflows/nodejs_npm/actions.py", line 114, in execute                              
      File "aws_lambda_builders/workflows/nodejs_npm/npm.py", line 72, in run                                       
    aws_lambda_builders.workflows.nodejs_npm.exceptions.NpmExecutionError: NPM Failed: npm warn Unknown cli config  
    "--unsafe-perm". This will stop working in the next major version of npm.                                       
    npm warn config production Use `--omit=dev` instead.                                                            
    npm warn deprecated @aws-lambda-powertools/tracer@1.18.1: Version 1.x has reached End-of-Life, please upgrade to
    2.x, more info here: https://s12d.com/upgrade-v2                                                                
    npm warn deprecated @aws-lambda-powertools/logger@1.18.1: Version 1.x has reached End-of-Life, please upgrade to
    2.x, more info here: https://s12d.com/upgrade-v2                                                                
    npm warn deprecated @aws-lambda-powertools/commons@1.18.1: Version 1.x has reached End-of-Life, please upgrade  
    to 2.x, more info here: https://s12d.com/upgrade-v2                                                             
    npm error code 128                                                                                              
    npm error An unknown git error occurred                                                                         
    npm error command git --no-replace-objects ls-remote ssh://git@github.com/StellantisSWx/ada-common-lib.git      
    npm error OpenSSL version mismatch. Built against 30000020, you have 30300030                                   
    npm error fatal: Could not read from remote repository.                                                         
    npm error                                                                                                       
    npm error Please make sure you have the correct access rights                                                   
    npm error and the repository exists.                                                                            
    npm error A complete log of this run can be found in:                                                           
    /home/billy/.npm/_logs/2025-05-02T22_56_22_188Z-debug-0.log                                                     
                                                                                                                    
    During handling of the above exception, another exception occurred:                                             
                                                                                                                    
    Traceback (most recent call last):                                                                              
      File "aws_lambda_builders/workflow.py", line 374, in run                                                      
      File "aws_lambda_builders/workflows/nodejs_npm/actions.py", line 117, in execute                              
    aws_lambda_builders.actions.ActionFailedError: NPM Failed: npm warn Unknown cli config "--unsafe-perm". This    
    will stop working in the next major version of npm.                                                             
    npm warn config production Use `--omit=dev` instead.                                                            
    npm warn deprecated @aws-lambda-powertools/tracer@1.18.1: Version 1.x has reached End-of-Life, please upgrade to
    2.x, more info here: https://s12d.com/upgrade-v2                                                                
    npm warn deprecated @aws-lambda-powertools/logger@1.18.1: Version 1.x has reached End-of-Life, please upgrade to
    2.x, more info here: https://s12d.com/upgrade-v2                                                                
    npm warn deprecated @aws-lambda-powertools/commons@1.18.1: Version 1.x has reached End-of-Life, please upgrade  
    to 2.x, more info here: https://s12d.com/upgrade-v2                                                             
    npm error code 128                                                                                              
    npm error An unknown git error occurred                                                                         
    npm error command git --no-replace-objects ls-remote ssh://git@github.com/XXXX/ada-common-lib.git      
    npm error OpenSSL version mismatch. Built against 30000020, you have 30300030                                   
    npm error fatal: Could not read from remote repository.                                                         
    npm error                                                                                                       
    npm error Please make sure you have the correct access rights                                                   
    npm error and the repository exists.                                                                            
    npm error A complete log of this run can be found in:                                                           
    /home/billy/.npm/_logs/2025-05-02T22_56_22_188Z-debug-0.log                                                     
    
    Build Failed
    

    Npm Logs

    255 warn deprecated @aws-lambda-powertools/tracer@1.18.1: Version 1.x has reached End-of-Life, please upgrade to 2.x, more info here: https://s12d.com/upgrade-v2
    256 warn deprecated @aws-lambda-powertools/logger@1.18.1: Version 1.x has reached End-of-Life, please upgrade to 2.x, more info here: https://s12d.com/upgrade-v2
    257 warn deprecated @aws-lambda-powertools/commons@1.18.1: Version 1.x has reached End-of-Life, please upgrade to 2.x, more info here: https://s12d.com/upgrade-v2
    258 http fetch GET 404 https://codeload.github.com/StellantisSWx/ada-common-lib/tar.gz/b1f4964d9c5a96f271ad6179aaa13da15652a0f8 891ms (cache skip)
    259 verbose stack Error: An unknown git error occurred
    259 verbose stack     at makeError (/home/billy/.nvm/versions/node/v22.14.0/lib/node_modules/npm/node_modules/@npmcli/git/lib/make-error.js:28:13)
    259 verbose stack     at /home/billy/.nvm/versions/node/v22.14.0/lib/node_modules/npm/node_modules/@npmcli/git/lib/spawn.js:37:26
    259 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    259 verbose stack     at async module.exports (/home/billy/.nvm/versions/node/v22.14.0/lib/node_modules/npm/node_modules/@npmcli/git/lib/revs.js:18:22)
    259 verbose stack     at async /home/billy/.nvm/versions/node/v22.14.0/lib/node_modules/npm/node_modules/pacote/lib/git.js:258:19
    259 verbose stack     at async withTempDir (/home/billy/.nvm/versions/node/v22.14.0/lib/node_modules/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js:21:14)
    259 verbose stack     at async withTempDir (/home/billy/.nvm/versions/node/v22.14.0/lib/node_modules/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js:21:14)
    260 error code 128
    261 error An unknown git error occurred
    262 error command git --no-replace-objects ls-remote ssh://git@github.com/XXXX/ada-common-lib.git
    263 error OpenSSL version mismatch. Built against 30000020, you have 30300030
    263 error fatal: Could not read from remote repository.
    263 error
    263 error Please make sure you have the correct access rights
    263 error and the repository exists.
    264 silly unfinished npm timer reify 1746225364270
    265 silly unfinished npm timer reify:unpack 1746225364389
    266 silly unfinished npm timer reifyNode:node_modules/ada-common-lib 1746225364390
    

    System Info

    Image

    The git --no-replace-objects ls-remote ssh://git@github.com/XXX/ada-common-lib.git command does run successfully when not invoked within sam

  6. roger-zhangg commented on Jul 2, 2026

    @roger-zhangg
    Member

    Hi, we're revisiting this issue during triage. We recently merged an OpenSSL update to version 3.3.7 (PR #9079) which may resolve the library version mismatch described here.

    Could anyone still experiencing this issue try upgrading to the latest SAM CLI release and report back?

    1. Your SAM CLI version (sam --version)
    2. Your OS and architecture
    3. Whether the CalledProcessError / OpenSSL mismatch still occurs after upgrading

    If the latest release resolves this, we'll close the issue. Thanks!

  7. roger-zhangg commented on Aug 1, 2026

    @roger-zhangg
    Member

    Closing this as stale — no response to the triage follow-up above in ~29 days.

    The OpenSSL update to 3.3.7 (#9079) has since shipped, which we believe addresses the library version mismatch described here.

    If you're still hitting this after upgrading to a recent SAM CLI release, please comment and feel free to re-open — no need to file a new issue. What we'd need:

    1. SAM CLI version (sam --version)
    2. Your OS and architecture
    3. The OpenSSL version on your system (openssl version)

    Thanks for the original report.

  8. github-actions commented on Aug 1, 2026

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    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.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions