title: AWS CodeBuild DOWNLOAD_SOURCE error: CLIENT_ERROR: reference delta not found
body: <p>I'm getting this error when trying to start a build on AWS CodeBuild:</p>
  
  <blockquote>
    <p>CLIENT_ERROR: reference delta not found for primary source and source version 0b0b4b6ebc477f92c2d51f2ac4ad0fc0ebc46782</p>
  </blockquote>
  
  <p>Is this error caused by git or AWS CodeBuild itself? How could I remove it?</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>Here is my CloudFormation configuration template:</p>
  
  <pre><code>CodeBuildProject:
      Type: AWS::CodeBuild::Project
      Properties:
        Artifacts:
          Type: NO_ARTIFACTS
        Cache:
          Location: LOCAL
          Modes:
            - LOCAL_CUSTOM_CACHE
          Type: LOCAL
        Environment:
          ComputeType: BUILD_GENERAL1_SMALL
          Image: aws/codebuild/standard:1.0
          ImagePullCredentialsType: CODEBUILD
          Type: LINUX_CONTAINER
        LogsConfig:
          CloudWatchLogs:
            Status: ENABLED
            GroupName: !Join ['/', ['', 'aws', 'codebuild', !Sub '${AWS::StackName}CodeBuildProject']]
        Name: !Sub '${AWS::StackName}CodeBuildProject'
        ServiceRole: !GetAtt CodeBuildProjectIAMRole.Arn
        Source:
          BuildSpec: |
            version: 0.2
            phases:
              install:
                commands:
                  - npm install -g yarn
                  - git config --global credential.helper '!aws codecommit credential-helper $@'
                  - git config --global credential.UseHttpPath true
                  - yarn
              pre_build:
                commands:
                  - git rev-parse HEAD
                  - git pull origin master
              build:
                commands:
                  - yarn run build
                  - yarn run deploy
              post_build:
                commands:
                  - echo 'Finished.'
          GitCloneDepth: 0
          Location: !ImportValue CodeCommitRepositoryCloneUrlHttp
          Type: CODECOMMIT
  </code></pre>