Sorry about the noise.

Turns out that a string-match-p was doing with a nil values variable in a function I added to the verilog-mode-hook. (And that variable was evaluating to nil only for a particular project.)

The error backtrace was confusing though.. it looked like set-auto-mode was throwing the error.

But actually it was 

set-auto-mode
  - set-auto-mode-0
    - (funcall mode)
      - run-hooks .. (running the major mode hook)
        - One of the functions in that hook

Is there a way so that an error like 

    Error in one of the functions in verilog-mode-hook while running some.file

gets printed instead of a misleading message that doesn't even mention the file causing it: 

File mode specification error: (wrong-type-argument stringp nil)
--

Kaushal Modi