Circleci config validate error

I’ve installed the circleci cli in Ubuntu running in WSL2. I used the manual installation method and already have docker installed and running. I executed the circleci setup command and all seems well there.

When I run circleci config validate on the basic say-hello workflow file, I get the following error:

Error: config compilation request returned an error: %!w()

I’m assuming I didn’t set something up correctly?

That’s interesting. I run it via WSL too, but I have not seen that error. Could you try the following for us:

  1. Run sudo circleci update
  2. Attempt to validate the smallest possible config, is it all configs or just they one you are testing?
  3. Can you share the config file you are validating or if possible, share the minimal version of it

Thanks Kyle.

I ran the update command and a new one installed. The config validation still fails, but I get a little more information now with the update:

Error: config compilation request returned an error: invalid character ‘I’ looking for beginning of value

I will dig into that some more. However, it does happen for all my config files, which includes the say-hello one, as well as a handful of other ones I have that are actively running in CircleCI.

# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/configuration-reference/#jobs
jobs:
  say-hello:
    # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
    # See: https://circleci.com/docs/configuration-reference/#executor-job
    docker:
      - image: cimg/base:stable
    # Add steps to the job
    # See: https://circleci.com/docs/configuration-reference/#steps
    steps:
      - checkout
      - run:
          name: "Say hello"
          command: "echo Hello, World!"

# Orchestrate jobs using workflows
# See: https://circleci.com/docs/configuration-reference/#workflows
workflows:
  say-hello-workflow:
    jobs:
      - say-hello

I copy / pasted the text from your example yaml config above, and validated fine for me with current homebrew version of the CLI

% circleci version  
0.1.26255+cc8c4de (homebrew)
% circleci config validate -c test.yaml
Config file at test.yaml is valid.
% file test.yaml 
test.yaml: ASCII text

Curious - if you run yamlllint [your config] (you’ll need to have yamllint installed) and file [your config], what does it say?

Running the suggested tests (plus a circleci version command) below.

$ circleci version
0.1.26343+7b38e08 (release)
$ file .circleci/config.yml
.circleci/config.yml: ASCII text
$ circleci config validate -c .circleci/config.yml
Error: config compilation request returned an error: invalid character 'I' looking for beginning of value

I know I’ve been successful with the cli in WSL in the past on other machines. This is a new setup to me.

Does it yamllint successfully too? And is the config in your example the same one in the text snippet above (the say-hello one)?

I neglected to put the yamllint result there too. It passes with the following (I think not relevant) issues:

test.yaml
  3:1       warning  missing document start "---"  (document-start)
  9:81      error    line too long (149 > 80 characters)  (line-length)

Yes, I’m testing with the exact one I pasted above. Also, I’ve tested with 4 other config.yml files that are actively working and building in CircleCI, all with the same circleci cli error above.

Just in case it was something specific to me running it on a Mac, I tried it on an Ubuntu Docker image:

% docker run -it ubuntu:18.04 /bin/bash
root@09dd5ee1a73c:/# apt-get -y update && apt-get -y install curl vim
root@09dd5ee1a73c:/# curl -sL -O https://github.com/CircleCI-Public/circleci-cli/releases/download/v0.1.26646/circleci-cli_0.1.26646_linux_arm64.tar.gz
root@09dd5ee1a73c:/# tar xvzf circleci-cli_0.1.26646_linux_arm64.tar.gz 
[...]
root@09dd5ee1a73c:/# vim config.yml
root@09dd5ee1a73c:/# cat config.yml 
---
version: 2.1

jobs:
  say-hello:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - run:
          name: "Say hello"
          command: "echo Hello, World!"

workflows:
  say-hello-workflow:
    jobs:
      - say-hello
root@09dd5ee1a73c:/# ./circleci-cli_0.1.26646_linux_arm64/circleci config validate -c config.yml 
Config file at config.yml is valid.

(note: with the current version, I do get an error if I don’t add version: 2.1)