slidevjs/slidev · error · Error
No active slide project found.
Error message
No active slide project found.
What it means
Thrown by the `slidev_getActiveSlide` VS Code language-model tool when the extension's `activeProject` ref is null/undefined. The tool exposes the currently focused deck to Copilot/Chat; it can only return data when at least one Slidev project has been detected and registered. The guard `if (project == null)` covers both the never-loaded case and the case where the active project was disposed.
Source
Thrown at packages/vscode/src/lmTools.ts:15
import { slash } from '@antfu/utils'
import { stringifySlide } from '@slidev/parser/core'
import { defineService, useDisposable } from 'reactive-vscode'
import { LanguageModelTextPart, LanguageModelToolResult, lm } from 'vscode'
import { useFocusedSlide } from './composables/useFocusedSlide'
import { activeEntry, activeProject, projects } from './projects'
export const useLmTools = defineService(() => {
const { focusedMarkdown, focusedSourceSlide, focusedSlideNo } = useFocusedSlide()
registerSimpleTool('slidev_getActiveSlide', () => {
const project = activeProject.value
if (project == null) {
throw new Error(`No active slide project found.`)
}
return formatObject({
'Entry file': project.entry,
'Root directory': project.userRoot,
'Preview server port': project.port.value || 'Not running',
'Number of slides': project.data.slides.length,
'Focused slide no. in presentation (from 1)': focusedSlideNo.value || 'None',
'Editing file': focusedMarkdown.value?.filepath || 'Not editing',
'Editing slide index in file (from 0)': focusedSourceSlide.value ? focusedSourceSlide.value.index : 'N/A',
})
})
registerSimpleTool('slidev_getSlideContent', (input: {
entrySlidePath: string
slideNo: number
}) => {
const project = resolveProjectFromEntry(input.entrySlidePath)View on GitHub (pinned to 0d798ace58)
Solutions
- Open a Slidev entry file (e.g. `slides.md`) in the editor so the extension registers the project and populates `activeProject`.
- Start the Slidev preview from a deck; the extension binds the active project on preview launch.
- Call `slidev_chooseEntry` with an explicit entry path to set the active entry, then retry `slidev_getActiveSlide`.
- If you expect a project but it is missing, run `slidev_listEntries` to confirm which decks the extension currently has loaded.
Defensive patterns
Strategy: type-guard
Type guard
// The extension's activeProject ref — guard before calling the tool:
import { activeProject } from './projects'
function hasActiveProject(): boolean {
return activeProject.value != null
} Try / catch
// registerSimpleTool already wraps invoke in try/catch and returns the message // as a LanguageModelTextPart, so the LM receives 'Error: No active slide project found.' // The caller (the model) should react by listing entries / choosing one.
Prevention
- Before invoking `slidev_getActiveSlide`, ensure a Slidev deck is open and registered.
- Have the model call `slidev_chooseEntry` first to establish an active project.
- Use `slidev_listEntries` to verify a project is loaded before assuming `activeProject` is set.
- Restart the preview / reopen the deck if the extension was reloaded and lost its project state.
When it happens
Trigger: The model invokes `slidev_getActiveSlide` before any Slidev markdown entry is open/registered in the workspace, or after the active project's preview was closed and its entry removed from the `projects` map. `activeProject.value` is null because no entry is focused.
Common situations: Opening the chat participant in a workspace with no `slides.md`, before starting a Slidev preview, or after closing all deck files. The `activeProject` ref tracks the currently focused editor's project; with nothing focused it is empty.
Related errors
- No content found for slide number ${input.slideNo} in entry:
- No slide found with title: "${input.title}".
- entrySlidePath is required.
- No active slide entry found. Please set an active slide entr
- No project found for entry: ${entry}. All entries: ${formatL
AI-assisted analysis of slidevjs/slidev@0d798ace58 (2026-08-12).
Data as JSON: /api/errors/ece6f82829aacee5.
Report an issue: GitHub.