This error occurs when attempting to view a special post type (such as a Portfolio post) or page template (the Archives page, for example)
Permalinks must be enabled and reset after creating posts or pages using custom templates. See the linked article for specific steps.
WordPress dynamically generates URLs for your content based on the setting you choose on the Permalinks page. Permalinks are both more semantic and search-engine friendly, but they are not the REAL URL to your content. While WordPress will regenerate permalinks on its own from time to time, you must manually regenerate them by resaving your settings when working with custom post types such as Portfolios or Galleries, after activating a new theme, importing old content, or setting up a new plugin.