Persist to workspace fails: /bin/tar: argument list too long




For our dependencies flow the last step -persist_to_workspace fails for the following error:

Error archiving workspace files: fork/exec /bin/tar: argument list too long

This is the the config.yml for the defaults step:

defaults: &defaults
  working_directory: ~/hydra
    - image: circleci/node:6-browsers
version: 2
    <<: *defaults
      - checkout
      - restore_cache:
            - root-node-{{ checksum "yarn.lock" }}
#      - restore_cache:
#          keys:
#            - public-node-{{ checksum "public/yarn.lock" }}
      - run:
          name: Yarn Dependencies
          command: |
            yarn install
            cd public
            yarn install
      - save_cache:
          key: root-node-{{ checksum "yarn.lock" }}
            - node_modules
      - save_cache:
          key: public-node-{{ checksum "public/yarn.lock" }}
            - public/node_modules
      - persist_to_workspace:
          root: /home/circleci
            - hydra
            - .ssh


When debugging via ssh ; the following command works fine:

circleci@b5d3f31aaaaf:~$ tar -czf workspace.tar.gz hydra .ssh

Which command does persist_to_workspace execute when providing multiple paths?


Could you tell us how many files are under hydra and .ssh?


.ssh: two files (id_rsa and known_hosts) -> deployment configuration

hydra: contains the git repository for the mobile build; which are quite a couple of files (3x node_modules ; .git … ), about 49746 items totalling 380 mb.

Does the persist_to_workspace step pipe every file to /bin/tar ? Tarring the directories works when providing the directory name


Just chiming in to note that we began experiencing this last night in the persist_to_workspace step of our build, too. We haven’t found a workaround yet.

It’s odd because I don’t think we’ve expanded the number of files in our build in any significant way.


Having the same problem on our project today. Persist to workspace step stopped working this morning with the same error:

Error archiving workspace files: fork/exec /bin/tar: argument list too long

What is happening?



For what it’s worth, here’s the relevant snippet:

- persist_to_workspace:
      root: /home/circleci/back_royal
        - .

There are 39,196 files in the directory (project directory + .git).

I’m guessing something changed in Circle CI’s infrastructure or code last night? I’ve gone back to look at when the builds started failing and our project’s file size didn’t seem to change at that time.


Looks like this started failing for us last night. Did someone change the tar invocation for the persist_to_workspace command?

Error archiving workspace files: exit status 2

This started failing for us last night as well.

It is concerning that it appears, based on multiple separate threads on here, that it is happening to “everyone” that says nothing.


Also happening for me.


I’d be interested to know if there is anyone it isn’t happening to :). To know if this a problem across the platform or is there specific to what we are doing…


I’ve upgraded to a paid plan to see if the behavior differs between free and paid and it does not. As such, I’ve opened a formal support request for this issue as well. In my particular case, my workspace is ~850M large with ~39K files.


I’m on a paid account and opened a support request yesterday. I’ve only heard back that it was relayed to the engineering department.


Please see Error archiving workspace files: exit status 2


Thanks, this did work. It was surprising since workspace was working fine and then stopped :). But after switching to a list of exactly the pieces I needed it is working again for me.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.