web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Knowledge sources not ...
Copilot Studio
Suggested Answer

Knowledge sources not working when being invoked from Generative answers node

(0) ShareShare
ReportReport
Posted on by 41
Hi, 
 
I have configured the SharePoint knowledge source in my agent via the Environment variables approach. This works only when Agent can use the knowledge anytime. But when the knowledge is set to 'When referenced by topics', the agent throws this error:

Error Message: The site '{Env.Agent_KnowledgeBase}' is invalid. Error Code: InvalidContent Conversation Id: ID Time (UTC): 2026-09-02T10:37:43.074Z
 
When 'Agents can use this knowledge source' is set to Anytime; the agent gives answers but when set to 'Only when referenced by topics'; the agent throws this error.
 
Please help me get a solution for this
Categories:
  • Suggested answer
    Haque Profile Picture
    4,278 Super User 2026 Season 2 on at
    Hi @Veddd007,
     

    At the very first place, I guess the environment variable placeholder {Env.Agent_KnowledgeBase} is not being resolved correctly in that mode. Can you please verify that the environment variable is correctly defined and accessible in the environment where the agent runs?

     

    It seems like "Only when referenced by topics" mode, the platform expects a fully resolved, concrete URL (when the topic references the knowledge source). If the environment variable is not resolved at that point, it treats the URL as invalid, causing the error.

    As a test, let's replace {Env.Agent_KnowledgeBase} with the actual SharePoint site URL in the knowledge source configuration and check if the error persists. If it works, this confirms the environment variable is not resolving in that mode (When referenced by topics').

     

    References:

    Add SharePoint as a knowledge source (specifically – "Use Variables as URLs" section).

     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • Suggested answer
    chiaraalina Profile Picture
    2,553 Super User 2026 Season 2 on at
     
    If you use a Globale Variable instead of an Environment Variable it works.
     
    Create the Globale Variable and in the Topic set it to the Environment Variable.
     
    In Knowledge reference the Global Variable:
     
     
    Let me know if it worked!
  • Suggested answer
    11manish Profile Picture
    4,802 Super User 2026 Season 2 on at
    SharePoint + Environment Variable is supported. The fact that it works in “Anytime” but fails in “Only when referenced by topics,” with {Env.Agent_KnowledgeBase} reported as the invalid site, strongly points to a Copilot Studio variable-resolution issue/regression in the topic-referenced knowledge path.

    So I would not spend further effort troubleshooting SharePoint permissions or changing the URL format until the static-vs-variable test is completed. If that test reproduces the difference, the appropriate next step is a Microsoft support/bug investigation, while using the static URL or “Anytime” configuration as the temporary workaround where acceptable.
  • Suggested answer
    Mohsin Ali Profile Picture
    1,073 on at
    Hello @Veddd007 -  The error suggests that {Env.Agent_KnowledgeBase} is not being resolved to the actual SharePoint URL when the knowledge source is used from a topic.
     
    Microsoft recommends using a global string variable, populating it from the environment variable, and then using that global variable in the SharePoint knowledge source URL.
    So I would request you to check the following:
    • Make sure the environment variable contains a valid SharePoint URL.
    • Store that value in a global variable.
    • Use the global variable in the topic-level knowledge source instead of referencing {Env.Agent_KnowledgeBase} directly.
    Also, its really worth checking following document for further understanding. 
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Copilot Studio

#1
Mohsin Ali Profile Picture

Mohsin Ali 360

#2
Valantis Profile Picture

Valantis 253 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 184 Super User 2026 Season 2

Last 30 days Overall leaderboard