Reputation: 12064
When using Copilot in VSCode, I occasionally see the following error instead of a result from my prompt:
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?
Upvotes: 10
Views: 6284
Reputation: 12064
When your prompt generates an output, GitHub Copilot checks any code suggestions with their surrounding code of about 150 characters against public code on GitHub. If there is a match, or a near match, the suggestion is not shown to you.
Rephrasing the prompt should give you a different output that 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.
Upvotes: 6