You are the latest victim of a problem Stack Overflow has had for years; there are conflicting rules about how NAA and VLQ flags are supposed to work.
The NAA flag description says:
This was posted as an answer, but it does not attempt to answer the question. It should possibly be an edit, a comment, another question, or deleted altogether.
(emphasis mine).
This matches the answer you flagged. It is clear, in context, that the answer is not an attempt to answer the question; rather, it is thanking the question asker for some useful information that we can see was contained in the question itself, without providing or attempting to provide any additional information - let alone an answer. If we treat this guidance as definitive, then you were pretty unambiguously correct to raise the flag.
The Help Center links to some network-wide guidance on NAA flags. (Well, actually it links to a duplicate question that in turn links to that guidance.) That guidance kinda contradicts itself about whether flagging an answer like this is correct. The very first paragraph says
The "not an answer" flag is a moderator flag that users can raise to notify moderators and privileged users that a posted answer does not make an attempt to answer the question, and should be deleted.
Emphasis on "the" above is mine; at first, we're explicitly defining what the NAA flag means in relation to the question the answer was posted under. Under this definition, an answer like "The total is 42." is NAA and appropriate to flag as such when posted in response to "How do I reverse a string?" but not when posted in response to "What is 21 + 23?".
... but then the same guidance kinda softly contradicts this interpretation, later:
When reviewing "not an answer" flags, moderators aren't shown the question or comments in context without clicking further, which they probably won't do unless there's an obvious reason to look for additional context. The same applies to flags handled in the review queue for privileged users, which requires reviewers to scroll or click through to view the question or other answers.
As suggested above, subtle problems can be more effectively handled by raising an "in need of moderator intervention" flag
So under this guidance, raising a NAA flag is... probably still correct to do, just maybe not always the best option, and it might be preferable to raise a custom moderator attention flag instead.
But that's not the end! There's also guidance specific to the Stack Overflow community, documented on our Meta site, that imposes a much stricter and less woolly rule (emphasis mine; emphasis from the original removed):
You flag as NAA things posted as answers that clearly and obviously do not attempt to answer an on-topic question or the question asked. If the fact that the answer isn't an attempt to answer isn't clear and obvious, without reading the question body, then instead of an NAA flag an "in need of moderator intervention" flag should be raised
This is not equivocal like the network-wide guidance. Here we are saying: if a moderator cannot tell just by looking at the answer itself, without context that it's a non-answer, then a NAA flag is incorrect, full stop. This is not what either the flag description or the network-wide guidance on Meta Stack Exchange says; it's a policy specific to Stack Overflow that is documented only on Meta Stack Overflow.
I guess that policy is the one you should follow; as long as these flags are being handled at least in part by our mod team, it wouldn't make any sense to use them in any way other than the way our mod team asks us to use them. But people are not born magically aware of that policy and can hardly be expected to discover it prior to coming to Meta Stack Overflow over a "wrongly" declined flag, like you have done, especially given that it flatly contradicts the wording of the flag reason that specifically defines what constitutes NAA in terms of the question that the answer is posted under.
Things get worse, though! Above I've only talked about what you're supposed to do as a flag raiser. What about as a flag handler? Well, it depends! The mods enforce the policy that NAA is only valid if the post can clearly be seen to not be an attempt to answer even without looking at the question. But ordinary users sometimes get the first bite at handling NAA flags, via the Low quality answers queue. And there, per both the "Learn more" popup and the Help Center instructions, we're supposed to do something different:
This queue contains answers that the system or other users have flagged as potentially problematic.
...
- Delete answers that do not address the question at all ...
(emphasis mine).
Posts entering the Low quality posts queue have been flagged as problematic by users or recognized by the system’s quality checks to be potentially low quality. This may include:
...
- answers that do not attempt to answer the question asked ...
...
Basic workflow
...
- Recommend deletion or Delete if you think that an answer does not address the question at all
(again, emphasis mine).
So, to sum up the five contradictory rules:
- Per the flag description, you were unambiguously correct to raise your flag
- Under the network-wide guidance on Meta Stack Exchange, your flag was still correct but you are advised that it's more helpful to use a custom moderator attention flag
- Under the guidance specific to Stack Overflow here on MSO, your flag was unambigously incorrect
- If a moderator on Stack Overflow handles such a flag, they will generally decline it in line with the policy above...
- ... but if an ordinary non-mod community member handles the flag, then we are supposed to delete the flagged post and thereby mark the flag as helpful, even though it was against policy for it to be raised in the first place.
This is, in my opinion, an utter mess. But it's not going to be fixed any time soon. People, including me, have been grumbling about it on Meta at least since 2018, and nothing has changed. The trouble is that fixing the system to sensibly implement Stack Overflow's site-specific policy would require:
- making a change to the NAA flag description and Help Center link on Stack Overflow only to reflect our narrower definition of NAA, and
- making NAA flags go only to mods, not to review queues, again on Stack Overflow only
Neither of these are changes that anyone other than staff can do.
The alternative fix is for the Stack Overflow mod team to choose to abandon the SO-specific policies we've got around NAA and embrace the definition given in the flag description - which would necessitate looking at the question a flagged answer is posted on before declining a NAA flag. But I assume they have already decided that the additional workload imposed by this would be intolerable, or else the policy we have wouldn't exist in the first place.
So we're stuck with this mess for the foreseeable future.