How to debug config

After much searching, I eventually found that the builds were not running because of a config error, logged in the ‘workflows’ display. But the logged errors are unreadable, and undocumented.

I ran across the cli tool, but the installation instructions don’t work, failing like so:

Unable to find image ‘circleci/picard@sha256:4e0de12cec3a7ff079097f26c0a1d3478a0cd67ec1032235fd97e9607d4820cb’ locally
Pulling repository circleci/picard
FATA[0061] Get https://registry-1.docker.io/v1/repositories/circleci/picard/tags: read tcp 52.206.40.44:443: i/o timeout

Are there any other options for debugging the config?

Could you share a link to your build, and post your config file either in a code block or in a gist at https://gist.github.com/? This will help a lot to debug your issue.

It was some yaml whitespace-counts-sometimes thing, plus the lack of support for ‘owner’ filters.
Is looking at each config individually really faster than documenting the schema & error messages? The output looks like some clojure thing, like spec or herbert, but maybe not precisely those. Can you just point to the docs for the lib that generates the error messages?

user=> (pprint foo)
{:workflows
{:build-n-deploy
{:jobs
[{:build (not (map? nil)), :filters {:branches disallowed-key}}
{:deploy-dev (not (map? nil)),
:requires (not (map? a-clojure.lang.LazySeq)),
:filters {:branches disallowed-key, :owner disallowed-key}}
{:deploy-cc (not (map? nil)),
:requires (not (map? a-clojure.lang.LazySeq)),
:filters {:branches disallowed-key, :owner disallowed-key}}
{:deploy-beta (not (map? nil)),
:requires (not (map? a-clojure.lang.LazySeq)),
:filters
{:tags disallowed-key,
:branches disallowed-key,
:owner disallowed-key}}]}}}

I don’t work in the development side of things, so I don’t know what library throws this error – at a guess, it looks like there’s a problem with your workflows filters. if I could see a link to your build though, I could help to debug what’s actually happening – non-CircleCI folks won’t be able to see your build, and CircleCI employees won’t be able to see your code. If you posted the config as a gist, non-CircleCI folks could also help to debug.

1 Like

Hi @Cormac,

I’m running into something similar. Can you shed some more light on this? The docs say that “tags” filter is allowed for workflow, but I get this message when my job is run:
"
We weren’t able to start this workflow.

Encountered errors trying to create workflows from this config: Config does not conform to schema: {:workflows {:wfBuild {:jobs [{:build (not (map? nil)), :filters {:tags disallowed-key}}]}}}

For more examples see the Workflows documentation.

"
The job link is a test job at https://circleci.com/gh/dexmagic/workflows/helloworld/tree/tag_test

On a side note, this kind of logging is not helpful, and the yaml parser seems to function inconsistently with what the documentation says. That’s all I can conclude unless the error tells me more about what it thinks is wrong with the yaml file.

On a lark I tried converting a line to a list element, because the CircleCI suggests workflow names can be list items?

#!/bin/sh -eo pipefail
# Unable to parse YAML

# while parsing a block mapping; expected <block end>, but found BlockEntry;  in 'string', line 35, column 3:
#       - wfBuild:
#       ^
false
Exited with code 1

Here is my yaml file:

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
#      - run:
#         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
#         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Run Tests
          command: ./gradlew lint test
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results
      # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

workflows:
  version: 2
  wfBuild:
    jobs:
      - build:
        filters:
          tags:
            # tag format: Major.minor.<yyear><weekofyear>.version
            only: /^\d+\.\d+\.\d+\.\d+/

My bad.

note to self: copy/paste of web pages and yaml files makes for interesting markdown.

Here is the CIrcleCI yaml output. The error doesn’t make sense because the YAML file is syntactically correct per: http://yaml-online-parser.appspot.com

jobs:
  Config Processing Error:
    docker:
    - image: bash:4.4.19
    steps:
    - run:
        name: Config Processing Error
        command: |-
          # Unable to parse YAML
          # null; mapping values are not allowed here;  in 'string', line 37, column 16:
          #             filters:
          #                    ^
          false
workflows:
  version: 2
  Config Processing Error:
    jobs:
    - Config Processing Error
version: 2

# Original config.yml file:
# version: 2
# jobs:
#   build:
#     working_directory: ~\/code
#     docker:
#       - image: circleci\/android:api-25-alpha
#     environment:
#       JVM_OPTS: -Xmx3200m
#     steps:
#       - checkout
#       - restore_cache:
#           key: jars-{{ checksum \"build.gradle\" }}-{{ checksum  \"app\/build.gradle\" }}
# #      - run:
# #         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
# #         command: sudo chmod +x .\/gradlew
#       - run:
#           name: Download Dependencies
#           command: .\/gradlew androidDependencies
#       - save_cache:
#           paths:
#             - ~\/.gradle
#           key: jars-{{ checksum \"build.gradle\" }}-{{ checksum  \"app\/build.gradle\" }}
#       - run:
#           name: Run Tests
#           command: .\/gradlew lint test
#       - store_artifacts:
#           path: app\/build\/reports
#           destination: reports
#       - store_test_results:
#           path: app\/build\/test-results
#       # See https:\/\/circleci.com\/docs\/2.0\/deployment-integrations\/ for deploy examples
# 
# workflows:
#   version: 2
#   jobs:
#     - build
#         filters:
#           tags:
#             # tag format: Major.minor.<yyear><weekofyear>.version
#             only: \/^\\d+\\.\\d+\\.\\d+\\.\\d+\/
#         


Ah, for your first file, your build key is null, as per the parser tool output. I bet stuff under it is insufficiently indented.

I guess I’m not seeing what you mean by the build key. But the version below doesn’t generate an error. It builds on the master branch even though the master branch isn’t listed in the only list, but that’s another topic.



version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    filters:
      branches:
        only:
          - tag_test
          - develop
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
#      - run:
#         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
#         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Run Tests
          command: ./gradlew lint test
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results
      # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

workflows:
  version: 2
  wfBuild:
    jobs:
      - build
#        filters:
#          branches:
#            only:
#              - tag_test
#          tags:
# tag format: Major.minor.<yyear><weekofyear>.version
#            only: /^\d+\.\d+\.\d+\.\d+/

I’m also trying to put the branch filter in the workflows section of the config file. It looks to me like the branch filter is formatted just like the example at https://circleci.com/docs/2.0/workflows/#using-regular-expressions-to-filter-tags-and-branches.

The error that CircleCI generates:

We weren't able to start this workflow.

Encountered errors trying to create workflows from this config: Config does not conform to schema: {:workflows {:wfBuild {:jobs [{:build (not (map? nil)), :filters {:branches disallowed-key}}]}}}

For more examples see the [Workflows documentation](https://circleci.com/docs/2.0/workflows).

And my YAML parser tells me it’s a good YAML file. Here’s the output from that:

{
  "version": 2, 
  "jobs": {
    "build": {
      "environment": {
        "JVM_OPTS": "-Xmx3200m"
      }, 
      "working_directory": "~/code", 
      "docker": [
        {
          "image": "circleci/android:api-25-alpha"
        }
      ], 
      "steps": [
        "checkout", 
        {
          "restore_cache": {
            "key": "jars-{{ checksum \"build.gradle\" }}-{{ checksum  \"app/build.gradle\" }}"
          }
        }, 
        {
          "run": {
            "command": "./gradlew androidDependencies", 
            "name": "Download Dependencies"
          }
        }, 
        {
          "save_cache": {
            "paths": [
              "~/.gradle"
            ], 
            "key": "jars-{{ checksum \"build.gradle\" }}-{{ checksum  \"app/build.gradle\" }}"
          }
        }, 
        {
          "run": {
            "command": "./gradlew lint test", 
            "name": "Run Tests"
          }
        }, 
        {
          "store_artifacts": {
            "path": "app/build/reports", 
            "destination": "reports"
          }
        }, 
        {
          "store_test_results": {
            "path": "app/build/test-results"
          }
        }
      ]
    }
  }, 
  "workflows": {
    "wfBuild": {
      "jobs": [
        {
          "build": null, 
          "filters": {
            "branches": {
              "only": [
                "tag_test", 
                "develop"
              ]
            }
          }
        }
      ]
    }, 
    "version": 2
  }
}

config.yml:


version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
#      - run:
#         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
#         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Run Tests
          command: ./gradlew lint test
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results
      # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

workflows:
  version: 2
  wfBuild:
    jobs:
      - build:
        filters:
          branches:
            only:
              - tag_test
              - develop
#          tags:
# tag format: Major.minor.<yyear><weekofyear>.version
#            only: /^\d+\.\d+\.\d+\.\d+/



See this bit?

In particular, build=null. That’s a reflection of your problem: your indentation is wrong.

This is a YAML problem, not a CircleCI problem. Try this:

  1. Load your YAML into the online parser, and make sure you get the JSON problem I have highlighted
  2. Put two extra spaces before each line after the build key, so filters, tags, the comment, and only.
  3. Make sure build is now populated in the parser output. I have done this now and it works.
  4. Copy the new YAML back into your desktop editor.
  5. Commit and push.

In other words, you need one of these…

:smiley_cat:

(Thanks to @claytron5000 for putting the link on another thread here).

1 Like

I see it now @halfer. Thanks for taking the time to elucidate. I’ll update and retest.

And I get the whole, “check your YAML” thing. Hopefully someone at CircleCI will realize how much time is acceptable to hunt down issues related to whitespace, and how much time is acceptable to cross-check config indentation and formatting in the first place. And I would suggest that the acceptable amount of time for both of those activities is precisely 0 seconds.

Feels like I’m in the home stretch. For my test today I got the branch filter working. Then I updated the filter to be tags. I pushed a tag of 1.2.3.4, and every push on the branch after that causes the build to run. I’m hoping to be able to run the build only the first time a specific tag is pushed.

Any ideas on how I should tweak my config file to make sure that happens?

Thanks again in advance.

Here’s what the server sees my workspace definition in my configuration file as …

workflows:
  version: 2
  wfBuild:
    jobs:
    - build:
        filters:
          tags:
            only:
            - /^\d+\.\d+\.\d+\.\d+/

Here’s the configuration file:

version: 2
jobs:
  build:
#    branches:
#      only:
#        - develop
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
#      - run:
#         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
#         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Run Tests
          command: ./gradlew lint test
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results
      # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

workflows:
  version: 2
  wfBuild:
    jobs:
      - build:
          filters:
#            branches:
#              only:
#                - tag_test
#                - develop
            tags:
              only:
                - /^\d+\.\d+\.\d+\.\d+/

#        filters:
#          branches:
#            only:
#              - tag_test
#              - develop
#          tags:
# tag format: Major.minor.<yyear><weekofyear>.version
#            only: /^\d+\.\d+\.\d+\.\d+/

Yes, by default filters are also “all branches”. You need an explicit “no branches” filter to go with your tag filter. See what I did in this demo project here, in the only-deploy-tags section. I believe this is in the documentation :smiley_cat:.

Incidentally, I’d recommend removing the only filter from your job and just rely on the workflows filter for now; there have been some reports of buggy behaviour with the job-level filter. I believe CircleCI are looking at it, but it is intermittent or dependent on some characteristic that is not immediately obvious.

A serious answer to the yaml problem is to set your ide/text editor to use 4 spaces(2 tabs). It makes it a lot easier to read. Also, checkout the cli: https://circleci.com/docs/2.0/local-cli/ This allows you to validate your yaml without pushing code changes.

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