diff --git a/src/pystencilssfg/configuration.py b/src/pystencilssfg/configuration.py
index a7bced43629ed8bdfa4e551d562ef9fe264a3d85..dc0aa214b438d82c11530b437ecff34a6933b26f 100644
--- a/src/pystencilssfg/configuration.py
+++ b/src/pystencilssfg/configuration.py
@@ -85,6 +85,15 @@ class SfgCodeStyle:
         prefix = " " * self.indent_width
         return indent(s, prefix)
 
+    def __post__init__(self):
+        if self.force_clang_format:
+            import shutil
+
+            if not shutil.which(self.clang_format_binary):
+                raise SfgException(
+                    "`force_clang_format` set to true in code style, but clang-format binary not found."
+                )
+
 
 @dataclass
 class SfgOutputSpec:
diff --git a/src/pystencilssfg/emission/clang_format.py b/src/pystencilssfg/emission/clang_format.py
index 309908fcf16e09e89c029799445fea6ae88a2b23..e663fec9ea1da6ff9709c58d56fb558b14711c85 100644
--- a/src/pystencilssfg/emission/clang_format.py
+++ b/src/pystencilssfg/emission/clang_format.py
@@ -8,11 +8,8 @@ from ..exceptions import SfgException
 def invoke_clang_format(code: str, codestyle: SfgCodeStyle) -> str:
     args = [codestyle.clang_format_binary, f"--style={codestyle.code_style}"]
 
-    if not shutil.which("clang-format"):
-        if codestyle.force_clang_format:
-            raise SfgException("Could not find clang-format binary.")
-        else:
-            return code
+    if not shutil.which(codestyle.clang_format_binary):
+        return code
 
     result = subprocess.run(args, input=code, capture_output=True, text=True)