I just wrote the following checker for syntax-checking Vala code using valac:

(flycheck-def-option-var flycheck-vala-packages nil vala-valac
  "A list of additional pakages for valac.

The value of this variable is a list of strings, where each string is what would get passed to valac's --pkg option."
  :type '(repeat (file :tag "Include package"))
  :safe #'flycheck-string-list-p
  :package-version '(flycheck . "0.20"))

(flycheck-def-option-var flycheck-vala-enable-experimental-non-null nil vala-valac
  "Whether to enable strict non-null checking for valac.

When non-nil, enable strict null checks as by --enable-experimental-non-null."
  :type 'boolean
  :safe #'booleanp
  :package-version '(flycheck . "0.20"))

(flycheck-define-checker vala-valac
  "A Vala syntax checker using valac."
  :command ("valac"
            "-c -o" null-device
            (option-flag "--enable-experimental-non-null" flycheck-vala-enable-experimental-non-null)           
            (option-list "--pkg" flycheck-vala-packages)
  :error-patterns ((error line-start 
                          ":" line "." column "-" line "." column ": error" (message) line-end)
                   (warning line-start
                        ":" line "." column "-" line "." column ": warning: " (message) line-end))
  :modes vala-mode)

(add-to-list 'flycheck-checkers 'vala-valac)

However, when I try to use it, I get the following two errors; the first on loading my init file:

Symbol's function definition is void: flycheck-checker-get

And this one when I try to use the checker on a Vala file:

Suspicious state from syntax checker vala-valac: Checker vala-valac returned non-zero exit code 1, but no errors from output: Unknown option -c -o
Run '/usr/bin/valac --help' to see a full list of available command line options.

Checker definition probably flawed.

I'm not sure about why this is happening, especially the first one. The second error is clearly due to argument order, but according to the valac manpage, both -c and -o are valid flags.

  • The first error indicates that you should re-compile all packages depending on Flycheck. If that doesn't fix the error, please start with --debug-init and post the traceback.
    – user227
    Jul 30, 2015 at 11:17
  • @lunaryorn It seems the issues were with me not having Flycheck updated and my init files not being fully good for live reloading. It all works now.
    – Koz Ross
    Aug 1, 2015 at 3:20

1 Answer 1


It's easy to forget that not all calls of a shell command involve shelling out. In case a process is called the proper way, a list of all of its arguments must be passed. Therefore it should be sufficient to change that list to:

        "-c" "-o" null-device
        (option-flag "--enable-experimental-non-null" flycheck-vala-enable-experimental-non-null)
        (option-list "--pkg" flycheck-vala-packages)

As for the other issue, this is probably due to not all (if any) functionality of Flycheck being loaded while loading up your Emacs setup. An easy fix for this is wrapping your code in an eval-after-load or with-eval-after-load (for Emacs versions greater or equal to 24.4), alternatively you can use (require 'flycheck) after (package-initialize) was run (which can either happen explicitly in your init file or implicitly after your init file was loaded for use with after-init-hook).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.