{"record":{"id":"37f44a1de8f06bb2","repo":"affaan-m/ECC","slug":"skill-file-not-found-skillfilepath","errorCode":null,"errorMessage":"Skill file not found: ${skillFilePath}","messagePattern":"Skill file not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/skill-evolution/versioning.js","lineNumber":36,"sourceCode":"    throw new Error('skillPath is required');\n  }\n\n  const resolvedPath = path.resolve(skillPath);\n  if (path.basename(resolvedPath) === 'SKILL.md') {\n    return path.dirname(resolvedPath);\n  }\n\n  return resolvedPath;\n}\n\nfunction getSkillFilePath(skillPath) {\n  return path.join(normalizeSkillDir(skillPath), 'SKILL.md');\n}\n\nfunction ensureSkillExists(skillPath) {\n  const skillFilePath = getSkillFilePath(skillPath);\n  if (!fs.existsSync(skillFilePath)) {\n    throw new Error(`Skill file not found: ${skillFilePath}`);\n  }\n\n  return skillFilePath;\n}\n\nfunction getVersionsDir(skillPath) {\n  return path.join(normalizeSkillDir(skillPath), VERSION_DIRECTORY_NAME);\n}\n\nfunction getEvolutionDir(skillPath) {\n  return path.join(normalizeSkillDir(skillPath), EVOLUTION_DIRECTORY_NAME);\n}\n\nfunction getEvolutionLogPath(skillPath, logType) {\n  if (!EVOLUTION_LOG_TYPES.includes(logType)) {\n    throw new Error(`Unknown evolution log type: ${logType}`);\n  }\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/skill-evolution/versioning.js#L18-L54","documentation":"ensureSkillExists resolves the SKILL.md path for a given skill directory and throws when that file does not exist on disk. The library requires every skill it versions or rolls back to have a real SKILL.md at the normalized skill directory. The message includes the resolved absolute path so you can see exactly where it looked.","triggerScenarios":"Calling ensureSkillExists (directly or via ensureSkillVersioning or rollbackTo) with a skillPath whose directory exists but contains no SKILL.md, or whose path resolves to the wrong directory after normalization.","commonSituations":"Typo in the skill directory name; skill folder created manually with only a draft file (e.g. skill.md lowercase); passing a path to the file itself instead of the directory so normalization doubles up SKILL.md; running the tool from a different repo root so relative skill paths miss; skill deleted or renamed before a rollback.","solutions":["Verify the resolved path in the error message and create the missing SKILL.md at that exact location","Fix the skillPath argument so it points at the directory containing SKILL.md (not the file itself)","Check casing/extension of the file — it must be exactly SKILL.md","Re-clone or restore the skill directory if it was deleted or moved"],"exampleFix":"// before\nawait rollbackTo('./skills/MySkill', 2); // wrong casing / wrong path\n// after\nawait rollbackTo('./skills/my-skill', 2); // dir containing SKILL.md exists","handlingStrategy":"type-guard","validationCode":"const fs = require('fs');\nif (!fs.existsSync(require('path').join(skillPath, 'SKILL.md'))) {\n  throw new Error(`Aborting: no SKILL.md in ${skillPath}`);\n}","typeGuard":"function hasSkillFile(dir) {\n  return typeof dir === 'string' && fs.existsSync(path.join(dir, 'SKILL.md'));\n}","tryCatchPattern":"try {\n  ensureSkillExists(skillPath);\n} catch (err) {\n  if (err.message.startsWith('Skill file not found')) {\n    console.error(`Check skillPath '${skillPath}': ${err.message}`);\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Always pass the skill directory, never the SKILL.md file path","Keep SKILL.md naming exact — uppercase, .md extension","Resolve relative paths against the repo root before calling","List skills programmatically (readdir) rather than hardcoding paths"],"tags":["filesystem","validation"],"backgroundTag":"file-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}