Improve error message for duplicate rules and unknown pools.

Also add more tests for invalid manifests. According to gcov, these invalid
inputs weren't tested before.