Use assert() instead of error() to detect internal errors.