I occasionally see the following error in VS Code Copilot chat:
Sorry, the response matched public code so it was blocked. Please rephrase your prompt
Why does this happen, what does it mean, and is there a way to avoid it?
I occasionally see the following error in VS Code Copilot chat:
Sorry, the response matched public code so it was blocked. Please rephrase your prompt
Why does this happen, what does it mean, and is there a way to avoid it?
2
Answers
This happens when the output generated by your prompt closely matches code on GitHub.
You can try rephrasing the prompt, which will give you a different result that hopefully doesn't match public code.
You can also tell Copilot to show the output anyway:
For more information, see enabling-or-disabling-suggestions-matching-public-code.
Note this is a commonly controlled organizational setting, so you may not be able to change it on a work account.
The previous answer explains the why. My setting is managed by corporate so I can’t change it. I just started using github copilot, but I have found using the inline copilot feature alleviates the public code issue encountered in the chat. Highlight section of code and right click to engage copilot.