Expected <block end>, but found '?'

I keep running into parsing errors in my config file and have tried different indentation schemes, after reading through similar questions here. I am still not having any luck.

while parsing a block collection

in ‘string’, line 12, column 5:

    - url: /favicon\.ico

    ^

expected block end, but found ‘?’

in ‘string’, line 21, column 5:

    steps:

    ^


version: 2.1
jobs:
test:
  machine:
      enabled: true
  steps:
      - run: echo "Test can run here!"
deploy:
  machine:
      enabled: true
handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico
- url: /static
  static_dir: public
- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto
steps:
- run:
     name: Install Java & Maven
     command: ssh $SSH_USER@$SSH_HOST "sudo apt-get update && sudo apt-get install -y curl git && sudo apt-get install -y openjdk-8-jdk && sudo apt-get install -y maven" 
- run:
     name: Clone Repo & Install Application Dependencies
     command: ssh $SSH_USER@$SSH_HOST "git clone https://github.com/my-name/my-application.git && cd ~/project-path"
- run:
     name: Deploy Application
     command: ssh $SSH_USER@$SSH_HOST "cd ~/project-path&& mvn verify"
- run:
     name: Run application 
     command: ssh $SSH_USER@$SSH_HOST "cd ~/project-path && mvn -Dmaven.test.skip=true spring-boot:run" 
workflows:
version: 2.1
test-and-deploy:
jobs:
  - test
  - handlers
  - deploy:
      requires:
        - test
        - handlers

I have tried using yaml linters/validators and they say my code is correct, i push the changes I have made and still get the same error. I’m really at a loss now.

Edit: I rewrote the whole file and now see:

while parsing a block mapping

in ‘string’, line 3, column 5:

    test:

    ^

expected block end, but found ‘block mapping start’

in ‘string’, line 21, column 8:

       steps:

       ^

What exactly does this error mean? Is it saying that steps on line 21 should be in column 5 instead of 8?

Hello,

You can find a restructured version of your config in this gist which will preserve the formatting if you want to copy/paste the raw text. This one passes locally with circleci config validate.

There was some issues with indentation, but the major issue is your use of handlers. It looks like you’re trying to call it as if it was a job in your workflows section. You might need to explain a bit more about what your intention is there, as it isn’t a supported CircleCI convention. But maybe there’s another way to do the same thing. For instance, if you just need to re-use some defined values throughout the config in jobs, you can consider using pipeline parameters in your config.

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