@@ -115,8 +115,19 @@ rec {
115115
116116 checkUnmatched =
117117 if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
118− let firstDef = head merged.unmatchedDefns;
119− in throw "The option `${showOption (prefix ++ firstDef.prefix)}' defined in `${firstDef.file}' does not exist."
118+ let
119+ firstDef = head merged.unmatchedDefns;
120+ baseMsg = "The option `${showOption (prefix ++ firstDef.prefix)}' defined in `${firstDef.file}' does not exist.";
121+ in
122+ if attrNames options == [ "_module" ]
123+ then throw ''
124+ ${baseMsg}
125+
126+ However there are no options defined in `${showOption prefix}'. Are you sure you've
127+ declared your options properly? This can happen if you e.g. declared your options in `types.submodule'
128+ under `config' rather than `options'.
129+ ''
130+ else throw baseMsg
120131 else null;
121132
122133 result = builtins.seq checkUnmatched {