slidevjs/slidev · error · Error

Runner for language "${lang}" not found

Error message

Runner for language "${lang}" not found

What it means

Thrown by the interactive code runner when a fenced code block requests a language with no registered CodeRunner. Built-in runners only cover javascript/js/typescript/ts; any other language must be registered via a setup or addon.

Source

Thrown at packages/client/setup/code-runners.ts:33

    ts: runTypeScript,
  }

  const { defaultHighlightOptions, getEagerHighlighter } = await (await import('./shiki')).default()

  const highlighter = await getEagerHighlighter()
  const highlight = (code: string, lang: string, options?: Partial<CodeToHastOptions>) => {
    return highlighter.codeToHtml(code, {
      ...defaultHighlightOptions,
      lang,
      ...options,
    })
  }

  const run = async (code: string, lang: string, options: Record<string, unknown>): Promise<CodeRunnerOutputs> => {
    try {
      const runner = runners[lang]
      if (!runner)
        throw new Error(`Runner for language "${lang}" not found`)
      return await runner(
        code,
        {
          options,
          highlight,
          run: async (code, lang) => {
            return await run(code, lang, options)
          },
        },
      )
    }
    catch (e) {
      console.error(e)
      return {
        error: `${e}`,
      }
    }
  }

View on GitHub (pinned to 0d798ace58)

Solutions

  1. Register a runner for the language via a code-runners setup or addon
  2. Change the fence language to js/ts if you only need JS execution
  3. Install an upstream code-runner addon for that language

Example fix

// before
```python
print(1)
```
// after - register in setup/code-runners.ts
runners.python = async (code, ctx) => { /* ... */ }
Defensive patterns

Strategy: validation

Validate before calling

const supportedLangs = ['javascript', 'js', 'typescript', 'ts', ...Object.keys(customRunners)]
if (!supportedLangs.includes(fenceLang)) {
  // either register a runner or hide the Run button
}

Type guard

function isRunnableLang(lang: string, runners: Record<string, unknown>): lang is string {
  return lang in runners
}

Prevention

When it happens

Trigger: Clicking Run on a ```python / ```go / ```rust (etc.) block without a corresponding runner registered through defineCodeRunner or an addon.

Common situations: Assuming Slidev can execute any language out of the box; typo in the fence language; addon that should register the runner not installed.

Related errors


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