microsoft/playwright · error · Error
Skill source directory not found: ${sourceDir}
Error message
Skill source directory not found: ${sourceDir} What it means
Thrown by installSkills() when the skill source directory computed by libPath('tools','skills',<name>) does not exist. libPath resolves inside the installed playwright-core package, so the error means the requested skill's assets were not shipped/present in the package layout. allSkills enumerates the supported names ('playwright-cli','playwright-component-testing','playwright-trace').
Source
Thrown at packages/playwright-core/src/tools/utils/installSkills.ts:36
import fs from 'fs';
import os from 'os';
import path from 'path';
import { libPath } from '../../package';
export const allSkills = ['playwright-cli', 'playwright-component-testing', 'playwright-trace'] as const;
export type SkillName = typeof allSkills[number];
export type SkillTarget = 'claude' | 'agents';
export async function installSkills(skills: readonly SkillName[], target: SkillTarget = 'claude', options?: { global?: boolean }) {
const cwd = process.cwd();
const baseDir = options?.global ? os.homedir() : cwd;
for (const skill of skills) {
const sourceDir = libPath('tools', 'skills', skill);
if (!fs.existsSync(sourceDir))
throw new Error(`Skill source directory not found: ${sourceDir}`);
const destDir = path.join(baseDir, `.${target}`, 'skills', skill);
await fs.promises.cp(sourceDir, destDir, { recursive: true });
console.log(`✅ Skill installed to \`${options?.global ? destDir : path.relative(cwd, destDir)}\`.`);
}
}
View on GitHub (pinned to c8fc3bf8d3)
Solutions
- Use one of the supported skill names: playwright-cli, playwright-component-testing, or playwright-trace.
- Reinstall the Playwright package cleanly (rm -rf node_modules and npm install) to restore missing bundled assets.
- If running from a git checkout, run the build/watch so that skill assets are placed under tools/skills/.
- Upgrade Playwright to a version that ships the skill you requested.
Example fix
// before npx playwright install-skills playwright-snapshot // after npx playwright install-skills playwright-trace
Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs';
import { allSkills } from '../tools/utils/installSkills';
function assertSkillAvailable(name: string) {
if (!(allSkills as readonly string[]).includes(name))
throw new Error(`Unknown skill: ${name}. Valid: ${allSkills.join(', ')}`);
if (!fs.existsSync(libPath('tools', 'skills', name)))
throw new Error(`Skill not shipped in this install: ${name}`);
} Type guard
function isSkillName(name: string): name is typeof allSkills[number] {
return (allSkills as readonly string[]).includes(name);
} Prevention
- Restrict skill names to the allSkills constant (playwright-cli, playwright-component-testing, playwright-trace).
- Reinstall Playwright cleanly if bundled assets are missing.
- Run the build in git checkouts so skill assets are generated before install-skills.
When it happens
Trigger: Running `npx playwright install-skills <name>` with a name not in allSkills, or against an installation where the tools/skills/<name> directory is missing (corrupted/partial install, dev build without bundling, wrong package).
Common situations: Using a dev/git checkout where skill assets are not generated/copied; partial npm install; typo in skill name; version that does not yet ship the requested skill.
Related errors
- --output-dir cannot point to a system directory: ${path.reso
- Init script file does not exist: ${script}
- Init page file does not exist: ${page}
- Trace file not found: ${filePath}
- Attachment name '${fileName}' escapes output directory
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/8a7c90e7aebc173f.
Report an issue: GitHub.