Throw error if compaction context is null.