# Run same job multiple times does not work

**URL:** <https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601>\
**Category:** Bug Reports\
**Tags:** workflow, workflows\
**Created:** [October 5, 2018, 10:28am UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601 "2018-10-05T10:28:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![goetas](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/goetas/32/14863_2.png) [@goetas](https://discuss.circleci.com/u/goetas)\
**Post date:** [October 5, 2018, 10:28am UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/1 "2018-10-05T10:28:31Z")

</div>

I’m trying to run the same job multiple times.  
I took the example from the official documentation (see [https://circleci.com/docs/2.0/reusing-config/#invoking-the-same-job-multiple-times](https://circleci.com/docs/2.0/reusing-config/#invoking-the-same-job-multiple-times)) (added the jobs section).

```
version: 2.1
jobs:
  loadsay:
    machine: true
    steps:
      - run: echo "hi"

  sayhello:
    machine: true
    steps:
      - run: echo "hello"

  saygoodbye:
    machine: true
    steps:
      - run: echo "bye"

workflows:
  version: 2
  build:
    jobs:
      - loadsay
      - sayhello:
          requires:
            - loadsay

      - sayhello:
          name: SayHelloChad

      - saygoodbye:
          requires:
            - SayHelloChad

```

The workflow does not start and return the following error:

> We weren’t able to start this workflow.  
> Encountered errors trying to create workflows from this config: Config does not conform to schema: {:workflows {:build {:jobs [nil nil {:sayhello {:name disallowed-key}} nil]}}}
> 
> For more examples see the [Workflows documentation](https://circleci.com/docs/2.0/workflows).

Any idea why?

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [October 5, 2018, 11:16am UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/2 "2018-10-05T11:16:20Z")

</div>

Just guessing here, does the version applied to your workflows have to match up with the version of the doc?

---

<div class="post-metadata">

**Author:** ![goetas](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/goetas/32/14863_2.png) [@goetas](https://discuss.circleci.com/u/goetas)\
**Post date:** [October 5, 2018, 11:32am UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/3 "2018-10-05T11:32:06Z")

</div>

I have tried to set `workflows` version to `2.1` but it says _“Unsupported or missing workflows config version”_.  
That makes sense since there are no doc info referring to any 2.1 version for workflows.

The weird thing is that the local circleci client says that the config file is valid… but then it fails when running it on circleci

```
$ circleci config validate
Config file at .circleci/config.yml is valid
```

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [October 5, 2018, 11:35am UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/4 "2018-10-05T11:35:30Z")

</div>

If you temporarily remove the second `sayhello` entry in the workflow, does that help? I wondered whether this section produces an associative array with (clashing) keys, but in fact it produces an indexed array of objects, so in YAML terms it would seem to be valid.

(You probably know the 2.1 format is experimental at present, this issue may be evidence of that!)

---

<div class="post-metadata">

**Author:** ![goetas](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/goetas/32/14863_2.png) [@goetas](https://discuss.circleci.com/u/goetas)\
**Post date:** [October 5, 2018, 11:44am UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/5 "2018-10-05T11:44:26Z")

</div>

Just by removing `name` from the 3rd job things work as expected. Sound as CircleCI bug.

As temporary workaround I have abused of YAML references and created two jobs as follows:

```
version: 2.1
jobs:
  loadsay:
    machine: true
    steps:
      - run: echo "hi"

  sayhello: &sayhello_ref
    machine: true
    steps:
      - run: echo "hello"
      
  SayHelloChad:
    <<: *sayhello_ref     

  saygoodbye:
    machine: true
    steps:
      - run: echo "bye"

workflows:
  version: 2
  build:
    jobs:
      - loadsay
      - sayhello:
          requires:
            - loadsay

      - SayHelloChad

      - saygoodbye:
          requires:
            - SayHelloChad
```

---

<div class="post-metadata">

**Author:** ![ndintenfass](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ndintenfass/32/156_2.png) [@ndintenfass](https://discuss.circleci.com/u/ndintenfass)\
**Post date:** [October 5, 2018, 10:00pm UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/6 "2018-10-05T22:00:42Z")

</div>

I strongly suspect the issue here is you don’t have Build Processing enabled in your project settings (under “Advanced” on your project’s settings page). Your original config runs fine for me when I have that on. The bug in this case may be that we need a much better error handling when passing 2.1 config without build processing on.

---

<div class="post-metadata">

**Author:** ![goetas](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/goetas/32/14863_2.png) [@goetas](https://discuss.circleci.com/u/goetas)\
**Post date:** [October 5, 2018, 10:09pm UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/7 "2018-10-05T22:09:43Z")

</div>

Wow! I missed that! It worked! Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [October 15, 2018, 10:09pm UTC](https://discuss.circleci.com/t/run-same-job-multiple-times-does-not-work/25601/8 "2018-10-15T22:09:48Z")

</div>

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