Pipelines System Error when LFS clone enabled: true
Asked by jhonsen.djajamuliadi:

I'm adding a step-level git-lfs clone in bitbucket-pipelines.yml file, as [described here](https://bitbucket.org/blog/support-for-more-clone-options-at-the-step-level), but it throws a System Error during build. The repo I'm working on is a forked repo that had git-lfs configured (it had .gitattributes in the repo).

```
?
```

```
image: continuumio/anaconda3:latest

pipelines:

  pull-requests:

    '**': # runs as default for any branch
    - step:
        name: build test 
        clone:
          lfs: true
        script:
          - if [ -f environment.yml ]; then conda env create -f environment.yml; fi
          - git clone --branch="test" git@bitbucket<somerepo>

```

Error encountered:

- error downloading object (error logs below)

Steps taken to resolve (but failed):

- Removed step-level clone, and specified it globally, but same error encountered

- Added \`git lfs install\` as part of build step instead of using \`clone: enabled: true\` but git lfs command is not recognized

+ umask 000  
+ git lfs 2>/dev/null >/dev/null || if [ $? -ne 0 ]; then exit 86; fi  
+ retry 6 git clone --branch="add_ci_backbone" $BUILD_DIR  
Cloning into '/opt/atlassian/pipelines/agent/build'...  
Downloading data/df_clean.csv (15 MB)  
**Error** downloading object: data/df_clean.csv (19f9dde): Smudge error: **Error** downloading data/df_clean.csv (sha...): [sha...] Object does not exist on the server: [404] **Object does not exist on the server**  
**Errors** logged to '/opt/atlassian/pipelines/agent/build/.git/lfs/logs/20221003T160918.187587842.log'.  
Use `git lfs logs last` to view the log.  
**error**: external filter 'git-lfs filter-process' failed  
fatal: data/df_clean.csv: smudge filter lfs failed  
warning: Clone succeeded, but checkout failed.  
You can inspect what was checked out with 'git status'  
and retry with 'git restore --source=HEAD :/'  
Attempt 1 of 6 failed.  
Retrying in 1 seconds  
Attempt 2 of 6 failed.  
Retrying in 2 seconds  
fatal: destination path '/opt/atlassian/pipelines/agent/build' already exists and is not an empty directory.  
fatal: destination path '/opt/atlassian/pipelines/agent/build' already exists and is not an empty directory.


Answers:
author: Syahrul
body: Hi [@jhonsen.djajamuliadi](/t5/user/viewprofilepage/user-id/5043902)

Welcome to the community!

Based on the log you shared, the clone is failing because it fails to download LFS files:

```
Error downloading object: data/df_clean.csv (19f9dde): 
Smudge error: Error downloading data/df_clean.csv (sha...): [sha...] Object does not exist on the server: [404] Object does not exist on the server
```

The remote repository is missing "data/df_clean.csv" files as per the above error.

Can you check if you have these files locally by running the following commands:

Locate the missing files, UUID exists locally:  

```
git lfs ls-files | grep 19f9dde
```

If the OID exists, push the files back to the remote repository:  

```
git lfs push origin --all
```

Once pushed, re-run the pipeline build again and let me know if that works.

Cheers,  
Syahrul

comments: author: jhonsen.djajamuliadi
body: Hi [@Syahrul](/t5/user/viewprofilepage/user-id/744536)

I appreciate your response! Following up on your suggestion works, I ended up on this [current limitations for git lfs with bb](https://support.atlassian.com/bitbucket-cloud/docs/current-limitations-for-git-lfs-with-bitbucket/#CurrentlimitationsforGitLFSwithBitbucket-fork) page and it helped me understand the issue.

Now it's been resolved. Thank you!

Jhonsen


Tags: bitbucket-cloud

bitbucket-pipelines

git-lfs