Header section not being generated for some files

For some reason, some of my pages for Q&A are being generated correctly with the correct header so that they appear fine within my theme. For example:

But, others are being generated without any of the html page or header info, so they are displaying without the theme wrapper at all:

Which PHP file is generating these pages and where is the code that is supposed to call the right header info?