Workflow not running, returns error "We weren’t able to start this workflow. Job X has filters configured in the job definition"

Hi,
I’m trying to run a build job on every commit, but also at a given time every weekday.
I have the jobs section working properly, but whenever I try to add the workflows, I get the error:

We weren’t able to start this workflow. Job “build” has filters configured in the job definition. These filters are incompatible with workflows.`

Note: jobs config is simplified in sample below.

version: 2
jobs:
  build:
    working_directory: ~/blah
    branches:
      only:
        - development
    steps:
        - checkout:
            path: ~/blah
        - run: 
            command: fastlane scan

workflows:
  version: 2
  morning:
    triggers:
      - schedule:
          cron: "0 14 * * 1-5" # 9am EST
          filters:
            branches:
              only:
                - development
    jobs:
      - build

I’ve tried:

  • removing branches from jobs
  • removing jobs from workflows
  • removing filters from triggers/schedule

Error is typically something like:

Encountered errors trying to create workflows from this config: Config does not conform to schema: {:workflows {:nightly {:triggers [{:schedule {:filters missing-required-key}}]}}}

Can someone help? Thanks in advance!

Here is my working workflow, I wonder if you have an indentation problem?

workflows:
  version: 2
  commit-workflow:
    jobs:
      - build
  daily-workflow-1:
    triggers:
      - schedule:
          cron: "0 14 * * *"
          filters:
            branches:
              only:
                - master
    jobs:
      - build

Try turning on your invisible characters in your editor to see if you have any tabs - they need to be spaces. Also, it might be worth looking at your line endings in case Windows 10/13 chars are confusing the parser.

Have you removed the branches section from jobs in the copy you are trying? It is still in your version above.

Thank you very much… I think you were right on the indentation, because a variant of your workflow magically works for me!

Followup questions:

  1. It seems that if I use workflows, I need to create a commit-workflow, which is fine… except that CircleCI will run parallel builds for each commit now. Can I enforce that only one build can be run at a time?
  2. Can I filter the commit-workflow to only run on certain branches?

How strange! I wonder if you had some tabs or something that confused the parser.

Yes, just implement the filter in the same way as the schedule workflow.

Ahh, I see now. Thank you very much for your help halfer.

For others who might read this:

  • I did have to remove the branches section from jobs

  • For question #1, you can check this out:
    https://circleci.com/docs/2.0/skip-build/

  • For question #2, I added the filter under triggers in the commit workflow and it seems to work. You can also add it directly without triggers, but note that the syntax is actually different

    commit-workflow:
      jobs:
        - build:
            filters:
              branches:
                only: development
1 Like

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