slidevjs/slidev · error · Error

entrySlidePath is required.

Error message

entrySlidePath is required.

What it means

Thrown by the `slidev_chooseEntry` VS Code LM tool when `input.entrySlidePath` is falsy. Unlike other tools that fall back to `$ACTIVE_SLIDE_ENTRY` via `resolveProjectFromEntry`, `chooseEntry` explicitly requires a concrete path because its whole purpose is to SET the active entry — an empty value would make the operation a no-op, so it is rejected up front.

Source

Thrown at packages/vscode/src/lmTools.ts:84

    if (entries.length === 0) {
      return 'No loaded Slidev project entries.'
    }
    return formatList(entries)
  })

  // Get project preview port
  registerSimpleTool('slidev_getPreviewPort', (input: { entrySlidePath: string }) => {
    const project = resolveProjectFromEntry(input.entrySlidePath)
    return formatObject({
      'Project entry': project.entry,
      'Preview port': project.port.value || 'Not running',
    })
  })

  // Choose active Slidev entry
  registerSimpleTool('slidev_chooseEntry', (input: { entrySlidePath: string }) => {
    if (!input.entrySlidePath) {
      throw new Error('entrySlidePath is required.')
    }
    const project = resolveProjectFromEntry(input.entrySlidePath)
    activeEntry.value = project.entry
    return formatObject({
      'Active entry switched to': project.entry,
    })
  })
})

function registerSimpleTool<T>(name: string, invoke: (input: T) => string) {
  useDisposable(lm.registerTool<T>(name, {
    invoke({ input }) {
      try {
        const result = invoke(input)
        return new LanguageModelToolResult([
          new LanguageModelTextPart(result),
        ])
      }

View on GitHub (pinned to 0d798ace58)

Solutions

  1. Provide a non-empty `entrySlidePath` (an absolute path or a substring that uniquely identifies a loaded entry).
  2. Call `slidev_listEntries` first to obtain the valid entry paths, then pass one verbatim.
  3. Ensure the model treats `entrySlidePath` as a required parameter in its tool-call schema.

Example fix

// before: missing required field
{ entrySlidePath: '' }
// after: pass a real entry from slidev_listEntries
{ entrySlidePath: '/abs/path/to/slides.md' }
Defensive patterns

Strategy: validation

Validate before calling

// Enforce the required field before calling slidev_chooseEntry:
function hasEntryPath(input: { entrySlidePath?: string }): input is { entrySlidePath: string } {
  return typeof input.entrySlidePath === 'string' && input.entrySlidePath.length > 0
}

Type guard

function isNonEmptyEntryPath(s: unknown): s is string {
  return typeof s === 'string' && s.trim().length > 0
}

Prevention

When it happens

Trigger: The model invokes `slidev_chooseEntry` with an empty string, undefined, or omits `entrySlidePath` entirely. Because this tool's contract is to switch the active entry, there is no sensible default and the guard rejects the call before any state mutation.

Common situations: The LM omits the parameter assuming a default; passes `$ACTIVE_SLIDE_ENTRY` or `''` (which is meaningless for a setter); or guesses a path without first listing valid entries.

Related errors


AI-assisted analysis of slidevjs/slidev@0d798ace58 (2026-08-12). Data as JSON: /api/errors/ffe8c313b80a7d63. Report an issue: GitHub.