<p>Running your <code>config.yml</code> through <a href="https://github.com/adrienverge/yamllint" rel="nofollow noreferrer">yamllint</a>, produced the following:</p>

<pre><code>  1:1       warning  missing document start "---"  (document-start)
  13:3      error    duplication of key "build" in mapping  (key-duplicates)
  25:19     error    syntax error: mapping values are not allowed here
</code></pre>

<p>When I add colons to the entry on lines 25 and 28: </p>

<pre><code>workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests:
          requires:
            - build
      - release:
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/
</code></pre>

<p>...the syntax error is no longer reported:</p>

<pre><code>1:1       warning  missing document start "---"  (document-start)  
13:3      error    duplication of key "build" in mapping (key-duplicates)
</code></pre>

CC BY-SA 4.0
2019-06-20T03:06:37.570Z
2019-06-20T03:06:37.570Z
Argyle
<p>You simply have an incorrect <a href="https://learnxinyminutes.com/docs/yaml/" rel="nofollow noreferrer">yaml syntax</a> in your <code>workflows</code> <code>jobs</code> list.</p>

<p>From what I could very quickly understand on <a href="https://circleci.com/docs/2.0/configuration-reference/#jobs-1" rel="nofollow noreferrer">circleCI's documentation</a>, jobs names are accepted as a shorthand if you don't define any parameters. If you have parameters, the list element is a hashmap with top element being the job name. In your specific case, this should give (note the column after the names of jobs with params):</p>

<pre><code>workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests:
          requires:
            - build
      - release:
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/
</code></pre>

CC BY-SA 4.0
2019-06-18T14:20:01.370Z
2019-06-18T14:20:01.370Z
Zeitounator
<p>Good morning. I'm migrating from Gitlab to CircleCI and try to map out a simple pipeline ("workflow") that basically should look like this:</p>

<pre><code>[build] -&gt; [tests] -&gt; [release*]
* only on tags
</code></pre>

<p>I wasted endless hours literally copy-pasting example configs from the documentation. I defined three jobs:</p>

<ol>
<li>build</li>
<li>tests</li>
<li>release</li>
</ol>

<p>And I created a minimal workflow that just echos the job title, includes some requires (to map the pipeline) and have a condition that only triggers releases on tags.</p>

<p>However, I always get a YAML parsing error:</p>

<pre><code>#!/bin/sh -eo pipefail
# Unable to parse YAML
# mapping values are not allowed here
#  in 'string', line 25, column 19:
#               requires:
#                       ^
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code 1
</code></pre>

<p>This is my <code>config.yaml</code> that currently fails:</p>

<pre><code>version: 2
jobs:
  build:
    steps:
      - run:
          name: Compile Binaries
          command: echo "Compile Binaries"
  tests:
    steps:
      - run:
          name: Run All Tests
          command: echo "Run All Tests"
  build:
    steps:
      - run:
          name: Release Artifacts
          command: echo "Release Artifacts"

workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests
          requires:
            - build
      - release
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/
</code></pre>

<p>I also tried online YAML validators but they always say this is valid YAML, so something is wrong with the way Circle expects the config to be. What could it be?</p>

<hr>

<p>Edit: I managed to even minify the example that causes the exact same error:</p>

<pre><code>jobs:
  build:
    steps:
      - run:
          name: Release Artifacts
          command: echo "Release Artifacts"

workflows:
  minimal:
    jobs:
      - release
          filters:
            tags:
              only: /^v.*$/
</code></pre>

<p>Causes:</p>

<pre><code>#!/bin/sh -eo pipefail
# Unable to parse YAML
# mapping values are not allowed here
#  in 'string', line 12, column 18:
#               filters:
#                      ^
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code 1
</code></pre>

<continuous-integration><configuration><yaml><circleci-2.0>
Unable to parse YAML: mapping values are not allowed here
q9f
# Unable to parse YAML: mapping values are not allowed here

(Asked by: username_0 on 2019-06-18)

Good morning. I'm migrating from Gitlab to CircleCI and try to map out a simple pipeline ("workflow") that basically should look like this:
[build] -> [tests] -> [release*]
* only on tags

I wasted endless hours literally copy-pasting example configs from the documentation. I defined three jobs:

build
tests
release

And I created a minimal workflow that just echos the job title, includes some requires (to map the pipeline) and have a condition that only triggers releases on tags.
However, I always get a YAML parsing error:
#!/bin/sh -eo pipefail
# Unable to parse YAML
# mapping values are not allowed here
#  in 'string', line 25, column 19:
#               requires:
#                       ^
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code 1

This is my config.yaml that currently fails:
version: 2
jobs:
  build:
    steps:
      - run:
          name: Compile Binaries
          command: echo "Compile Binaries"
  tests:
    steps:
      - run:
          name: Run All Tests
          command: echo "Run All Tests"
  build:
    steps:
      - run:
          name: Release Artifacts
          command: echo "Release Artifacts"

workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests
          requires:
            - build
      - release
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/

I also tried online YAML validators but they always say this is valid YAML, so something is wrong with the way Circle expects the config to be. What could it be?

Edit: I managed to even minify the example that causes the exact same error:
jobs:
  build:
    steps:
      - run:
          name: Release Artifacts
          command: echo "Release Artifacts"

workflows:
  minimal:
    jobs:
      - release
          filters:
            tags:
              only: /^v.*$/

Causes:
#!/bin/sh -eo pipefail
# Unable to parse YAML
# mapping values are not allowed here
#  in 'string', line 12, column 18:
#               filters:
#                      ^
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code 1

**Tags:** continuous-integration, configuration, yaml, circleci-2.0


---

## 2 answers

### Answer by username_1 on 2019-06-20. Score: 4 | Accepted answer

Running your config.yml through yamllint, produced the following:
  1:1       warning  missing document start "---"  (document-start)
  13:3      error    duplication of key "build" in mapping  (key-duplicates)
  25:19     error    syntax error: mapping values are not allowed here

When I add colons to the entry on lines 25 and 28: 
workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests:
          requires:
            - build
      - release:
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/

...the syntax error is no longer reported:
1:1       warning  missing document start "---"  (document-start)  
13:3      error    duplication of key "build" in mapping (key-duplicates)


---

### Answer by username_2 on 2019-06-18. Score: 4

You simply have an incorrect yaml syntax in your workflows jobs list.
From what I could very quickly understand on circleCI's documentation, jobs names are accepted as a shorthand if you don't define any parameters. If you have parameters, the list element is a hashmap with top element being the job name. In your specific case, this should give (note the column after the names of jobs with params):
workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests:
          requires:
            - build
      - release:
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/


---

