GitbookIO/gitbook · warning · Error
No documentation page is currently open to submit feedback f
Error message
No documentation page is currently open to submit feedback for.
What it means
Thrown by the submit_page_feedback AI tool (useSubmitPageFeedbackTool) when it runs while currentPage is null in its ref state. The tool needs the currently open documentation page to attribute the feedback event; if the assistant is rendered in a context with no ambient current page (e.g. a standalone/embed assistant tab not bound to a page), the execute throws.
Source
Thrown at packages/gitbook/src/components/AI/useSubmitPageFeedbackTool.ts:101
"Submit the feedback on behalf of the user about the documentation page they are currently viewing. Use this when the user is indicating a sentiment about the page, particularly a negative one, or pointing to incorrect or incoherent information on a page. Proactively suggest to submit feedback for the user to help alleviate frustration or indicate a content gap they've encountered. The user will be asked to confirm before the feedback is recorded. Provide a rating and, when the user gave one, a comment in their own words.",
confirmation: (input) => {
const parsed = SubmitPageFeedbackInputSchema.safeParse(input);
const comment = parsed.success ? parsed.data.comment?.trim() : undefined;
return {
icon: 'paper-plane',
label: tString(language, 'ai_chat_tools_submit_feedback', ''),
context: comment ? `"${comment}"` : undefined,
};
},
inputSchema: zodToJsonSchema(
SubmitPageFeedbackInputSchema as any
) as AIToolDefinition['inputSchema'],
execute: async (input) => {
const { trackEvent, language, currentPage, displayContext } = ref.current;
const { rating, comment } = SubmitPageFeedbackInputSchema.parse(input);
if (!currentPage) {
throw new Error(
'No documentation page is currently open to submit feedback for.'
);
}
const pageFeedbackRating = ratingByInput[rating];
const trimmedComment = comment?.trim() || undefined;
const pageContext: InsightsEventPageContext = {
pageId: currentPage.pageId,
displayContext,
};
trackEvent(
{ type: 'page_post_feedback', feedback: { rating: pageFeedbackRating } },
pageContext,
{ immediate: !trimmedComment }
);
View on GitHub (pinned to db67585ee2)
Solutions
- Pass the current page into the component that creates the tool (ensure currentPage in ref is set from your routing/page context).
- In the tool wrapper, return a graceful 'cannot submit page feedback here' result instead of throwing when currentPage is null.
- Restrict the tool: only register submit_page_feedback when the assistant is bound to a page context (filter available tools by display context).
- If embedding, open the assistant from within a documentation page so page context exists.
Example fix
// before
if (!currentPage) {
throw new Error('No documentation page is currently open to submit feedback for.');
}
// after
if (!currentPage) {
return { success: false, reason: 'no-page-open' };
} Defensive patterns
Strategy: validation
Validate before calling
if (!currentPage) {
// skip registering / calling the page feedback tool
return tools.filter((tool) => tool.name !== 'submit_page_feedback');
} Type guard
const hasCurrentPage = (
ctx: { currentPage?: CurrentPageInfo | null }
): ctx is { currentPage: CurrentPageInfo } => !!ctx.currentPage; Try / catch
try {
await submitPageFeedbackTool.execute(input);
} catch (error) {
if (error instanceof Error && error.message.includes('No documentation page')) {
return { success: false, reason: 'no-page' };
}
throw error;
} Prevention
- Only register the page-feedback tool in page-bound display contexts.
- Wire your routing state into currentPage in the tool's ref.
- Return structured failures from tools instead of throwing for expected conditions.
When it happens
Trigger: Executing the page-feedback tool when ref.current.currentPage is null — e.g. the assistant runs on a non-page route or in the embed's assistant tab with no page context; the page context wasn't propagated to the component providing the tool; invoking the tool from a search/ask flow that never resolved to a page.
Common situations: Using the embedded assistant outside documentation pages; a custom integration rendering AI chat without passing the current page; refactors that stopped populating currentPage in the tool's ref.
Related errors
- There is no previous response to rate.
- No response found
- The AI Assistant is not enabled for this site.
- useAI must be used within AIContextProvider
- AI Search is not enabled for this site.
AI-assisted analysis of GitbookIO/gitbook@db67585ee2 (2026-08-28).
Data as JSON: /api/errors/58482cb8c548ede6.
Report an issue: GitHub.