CircleCI Doesn't find workflow in configuration

I am seeing this error:

Build-agent version 0.0.4761-f18e895 (2018-03-20T01:12:48+0000)
Configuration errors: 1 error occurred:

* Cannot find a job named `build` to run in the `jobs:` section of your configuration file.
If you expected a workflow to run, check your config contains a top-level key called 'workflows:'

I understand from the docs that I only have to have a job called build if I am NOT using workflows. I am using workflows, there is a workflows key.

What is wrong?

My full .circleci/config.yml:

Javascript Node CircleCI 2.0 configuration file

# Check for more details
version: 2
    working_directory: ~/TryGhost/spirit
      # CircleCI maintains a library of pre-built images
      # documented at
      # This is closest to our current server version
      - image: circleci/node:6.13.0
      - checkout

      # Make sure CircleCI can access our server
      - run: ssh-keyscan $PRD_SERVER >> ~/.ssh/known_hosts

      # Dependencies
      # Restore the dependency cache
      - restore_cache:
          # This branch if available
          - v1-dep-{{ .Branch }}-
          # Default branch if not
          - v1-dep-master-
          # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
          - v1-dep-
      # Install dependencies
      - run: yarn
        # Save dependency cache
      - save_cache:
          key: v1-dep-{{ .Branch }}-{{ epoch }}
          - ~/.cache/yarn
          - ./node_modules

      # Deploy!
      - run: yarn deploy production

# Start here! This defines what actually happens and when
  version: 2
      - deploy:
          # This context loads the user & ips for staging & production
          context: GhostOrg
            # Only deploy on tags
              only: /^v.*/

I’ve run into this error 4 or 5 times whilst setting up configs and each time I keep fixing it, seemingly, by deleting and re-adding whitespace and retrying.

Am I going mad?

Do you have a “view whitespace characters” feature in your editor? YAML parsers tend to trip up spectacularly on tabs, I believe it must be spaces.

1 Like

I do - there are only spaces in the config

To follow up I have the exact same config working, but using this in workflows:

  version: 2
      - deploy:
          context: GhostOrg
              only: master

That is - branch filter instead of tags and no comments. I tried updating that config to include the comments and it still worked. So its not the comments.

Next I tried switching the tag config shown above to using branches. On that project I’m not getting any new builds triggered at all now unless I manually post to the API using curl.

I’ve seen reports on here that some people don’t get new builds triggered if their workflows are misconfigured… but my config is now identical to the working one with the exception of the working directory name…

To clarify.

I now have 2 identical builds on 2 very similar repos with identical config except the “workspace” path.

One does exactly what it should.
The other one fails with this error.

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