skip to Main Content

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


  1. Chosen as BEST ANSWER

    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:

    1. In the upper-right corner of any page on GitHub, click your profile photo, then click Settings.
    2. In the left sidebar, click Copilot.
    3. Under Suggestions matching public code, select the dropdown menu, then click Allow to allow suggestions matching public code, or Block to block suggestions matching public code.
    4. To confirm your new settings, click Save.

    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.


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search