There are restrictions on panel locations in the NEC, but they do not include hallways.
Here in NJ, when there is a code infraction, the AHJ or inspector mist cite the article on the "failure" or violation sticker, and sign the sticker. You should have the "right" to know what "code" you violated.
Perhaps, it's a "personal" thing with the building inspector??
Does your area have a "board of appeals", or is there someone with more authority than the inspector who "failed" your job?
Or, could it be a "decorator's" thing (who wants that ugly panel in the hall???)