diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Revision history for ghctags
 
+## 0.4.0.2
+
+* Fixed a bug: no headers for ctag file when `--stream` option was not set.
+
 ## 0.4.0.1
 
 * `ghc-tags-plugin` is now compatible with `GHC-9.4`.
diff --git a/ghc-tags-plugin.cabal b/ghc-tags-plugin.cabal
--- a/ghc-tags-plugin.cabal
+++ b/ghc-tags-plugin.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.4
 name:                ghc-tags-plugin
-version:             0.4.0.1
+version:             0.5.0.0
 synopsis:            A compiler plugin which generates tags file from GHC parsed syntax tree.
 description:
   A [GHC compiler plugin](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/extending_ghc.html?highlight=compiler%20plugin#compiler-plugins)
@@ -18,7 +18,7 @@
                      README.md
 homepage:            https://github.com/coot/ghc-tags-plugin#readme
 bug-reports:         https://github.com/coot/ghc-tags-plugin/issues
-tested-with:         GHC==8.8.4, GHC==8.10.7, GHC==9.0.1, GHC==9.2.4, GHC==9.4.2
+tested-with:         GHC==8.8.4, GHC==8.10.7, GHC==9.0.2, GHC==9.2.4, GHC==9.4.2
 
 -- Don't build gtp-check command by default; it's a development tool.
 flag gtp-check
diff --git a/lib/Plugin/GhcTags.hs b/lib/Plugin/GhcTags.hs
--- a/lib/Plugin/GhcTags.hs
+++ b/lib/Plugin/GhcTags.hs
@@ -19,12 +19,13 @@
 import qualified Data.ByteString.Builder as BB
 import qualified Data.Text as Text
 import qualified Data.Text.Encoding as Text
-#if __GLASGOW_HASKELL__ < 808
-import           Data.Functor (void, (<$))
-#endif
 import           Data.Functor.Identity (Identity (..))
 import           Data.List (sortBy)
-import           Data.Either (partitionEithers)
+#if __GLASGOW_HASKELL__ < 810
+import           Data.Either (rights)
+#else
+import           Data.Either (partitionEithers, rights)
+#endif
 import           Data.Foldable (traverse_)
 import           Data.Maybe (mapMaybe)
 import           System.Directory
@@ -498,8 +499,8 @@
               Right (Left err) ->
                 printMessageDoc dynFlags ParserException (Just ms_mod) err
 
-              Right (Right !parsed) -> do
-                let (headers, !parsedTags) = partitionEithers parsed 
+              Right (Right parsed) -> do
+                let parsedTags = rights parsed 
 
                     tags :: [CTag]
                     tags = map (fixTagFilePath cwd tagsDir)
@@ -515,7 +516,7 @@
                     combined = combineTags CTag.compareTags modulePath tags parsedTags
 
                 BB.hPutBuilder writeHandle
-                          (    foldMap CTag.formatHeader headers
+                          (    foldMap CTag.formatHeader CTag.headers
                             <> foldMap CTag.formatTag combined
                           ) 
 
