Bob's favourite piano piece is Beethoven's Moonlight Sonata. Alice would like to play Bob's favourite piece, and she can play the Moonlight Sonata, but she doesn't know that it is Bob favourite piece, nor can she find out that it is. Can Alice play Bob's favourite piano piece?
In one sense yes, in another no. It's a kind of de re/de dicto ambiguity. Alice can play what is in fact Bob's favourite piece, but she can't play it "under that description", loosely speaking.
Let's continue the story.
Knowing that the Moonlight Sonata is fairly popular, Alice decides to play it, in the hope that she will thereby play Bob's favourite piece; she is not at all confident that she will succeed, of course, and she has no other reason to play the Moonlight Sonata. So she plays the Moonlight Sonata with the intention to thereby play Bob's favourite piece, and as it happens she succeeds. Now, can Alice play Bob's favourite piece?
My intuition is not particularly clear, but it seems to me that in the de dicto sense in which the answer to the question was 'no' before, it is still 'no'. I have asked two innocent bystanders and they share this intuition.
If that's right, we seem to have a new type of counterexample to the counterfactual analysis of ability, on which 'S can phi' means that S would phi if S intended to phi.
The counterfactual analysis is clearly targeted at the de dicto reading of ability statements: the point of the de re sense is precisely that the agent does not have to intend to perform the act under the given description phi.
In the piano scenario, Alice intends to play Bob's favourite piece, she succeeds, and yet she can't (de dicto) play his favourite piece.
What is missing?
Perhaps we need some kind of anti-luck condition: it shouldn't be a coincidence that Alice ends up doing what she intends to do. Some recently popular accounts of ability, on which S is able to phi iff S phis in a sufficiently high proportion of relevant possible worlds, also point in that direction: the relevant worlds presumably include worlds where Bob's preferences are different.
However, it arguably wouldn't matter if Bob had his musical preferences essentially so that there are no possible worlds at all (let alone nearby worlds) where his favourite piece is anything other than the Moonlight Sonata. Moreover, in the case at hand, I'm not interested in whether Alice has the general ability to play Bob's favourite piece. I want to know whether she can play his favourite piece right now, in the present circumstances. When we consider these kinds of specific ability claims, it would be wrong to look at the agent's track record in various counterfactual or even counterpossible circumstances. So we should not consider worlds where Bob's tastes are different. (So we also have a counterexample to those more recent analyses of ability.)
The real problem, I think, is that Alice is not sufficiently confident that if she were to play the Moonlight Sonata, she would be playing Bob's favourite piece. By her lights, it could easily be the case that his favourite piece is something else. That's what matters.
One might say that while Alice intends to play Bob's favourite piece, she isn't intentionally playing Bob's favourite piece, because intentionally doing something requires knowing that one does it.
Actually, knowledge seems to strong. For one thing, contemplating skeptical scenarios does not destroy intentionality: the fact you are thinking about brains in a vat does not imply that anything you do (any harm you cause, for example) is unintentional; nor does it imply that you suddenly lose almost all of your (de dicto) abilities.
Gettier conditions also seem irrelevant: you could intentionally throw a rock at the single barn in fake barn land, even if you don't know that the barn is a barn; if you're able to throw the rock, you have the (de dicto) ability to throw the rock at the barn.
We also don't need especially high confidence. If Alice knows that Bob belongs to the Moonlight Sonata fan club, of whose members 95 percent rank the Moonlight Sonata as their favourite piece, it seems to me that she could intentionally play Bob's favourite piece, and she would have the de dicto ability to play his favourite piece. (The fact that her evidence is statistical doesn't seem to matter, although it arguably undermines her claim to knowledge.)
I'm not very sure about all these judgements though. I'm even less sure about justification. If Alice happens to believe for no good reason at all that Bob's favourite piece is the Moonlight Sonata, can she de dicto and intentionally play Bob's favourite piece?
In any case, the de re/de dicto ambiguity seems to arise not from an ambiguity in 'can' but from a kind of ambiguity in the embedded verb phrase: we can read 'phi' in 'S can phi' as 'phi intentionally' or as 'phi in some way or other'.