Kant seems to provide a theory of beauty without providing a theory of ugliness, and it's a famous interpretive problem to see what his theory of ugliness could be.
Here's a suggestion in the spirit of what I take Kant's story to be, which I'd like to propose on its own merits (I don't claim its what Kant had in mind).
On my current version of the Kantian story beautiful objects are a kind of curiosity porn. They fit so well with our investigative faculties that their pattern of descriptive features tempts us to look for endless purposive explanations (the art is like this in order to let us detect that) without expecting that these should fit into any overall goal (the overall point of getting us to see all these things is to..).
Maybe ugly objects are ones that actively extinguish this kind of curiosity. So, for example, when a poem makes you suspect that the poets only goal was to shock the reader by using profanity, or impress them with erudition, you might say that this suggests that there are NOT going to be more interesting features of the art which will tempt one to give purposive explanations. You feel like you know everything substantive there is to know about 'why' the art is like it is - there will obviously be a historical explanation for why the poet chose those particular profanities or allusions (e.g. they were the ones he had heard most recently) but this explanation has nothing to do with the intended effects on an audience.
I think there's a remark in Wittgenstein's notes on culture and value to the effect that when things in nature seem ugly to us, they seem to resemble human artifacts. That fits nicely with this theory of ugliness - you can only feel like you've exhausted all there is to notice by way of as-if-purposive explanations for something in nature if it feels to you like human production whose total (paltry) intended effect is all too clear.
Hmm maybe this theory does solve the interpretive problem too. Guyer puts the problem like this:
‘Since harmonious free play is always pleasurable, and since
all judgements of taste are accompanied by harmonious free play, it fol-
lows that every judgement of taste must be accompanied by the feeling of
pleasure in the subject which ipso facto makes every judgement of taste a
positive judgement of taste.'
So here's what I'd say. Yes every judgment of taste involves the harmonious free play of intellect and imagination, and yes as such every judgment of taste is pleasurable. (Isn't making a negative judgment of taste e.g. putting your finger on the self-indulgence or incoherence etc that makes you judge the work ugly and stop looking for more aesthetic subtlties often quite fun?) Kant says that pretty much any case of getting what you want is pleasurable, and figuring things out about an object that initially raised your curiosity to look for purposive explanations is one special case of this.
But the fact that you are experiencing this pleasure doesn't mean that you should return a positive verdict on the asethetic merits of the work of art. Insofar as the artwork doesn't give you pleasure *by giving you a feeling of purposiveness without purpose* (Kant's definition of the experience of beauty) you shouldn't judge that the work is beautiful. Just as much as he clearly says that pleasure in a work that comes from that works alignment with your interests doesn't count towards aesthetic merit, the pleasure that comes from disinterested aesthetic investigation leading to the result that some object suggested for aesthetic consideration is trivial shouldn't count towards the merit of the work.