{"record":{"id":"fa724e1daf2ba0db","repo":"upstash/context7","slug":"failed-to-install-skill-name-errmsg","errorCode":null,"errorMessage":"Failed to install ${skill.name}: ${errMsg}","messagePattern":"Failed to install (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/skill.ts","lineNumber":457,"sourceCode":"          await symlinkSkill(skill.name, primarySkillDir, targetDir);\n        } catch (dirErr) {\n          const error = dirErr as NodeJS.ErrnoException;\n          if (error.code === \"EACCES\" || error.code === \"EPERM\") {\n            permissionError = true;\n            failedDirs.add(targetDir);\n          }\n          throw dirErr;\n        }\n      }\n\n      installedSkills.push(`${skill.project}/${skill.name}`);\n    } catch (err) {\n      const error = err as NodeJS.ErrnoException;\n      if (error.code === \"EACCES\" || error.code === \"EPERM\") {\n        continue;\n      }\n      const errMsg = err instanceof Error ? err.message : String(err);\n      log.warn(`Failed to install ${skill.name}: ${errMsg}`);\n    }\n  }\n\n  if (permissionError) {\n    installSpinner.fail(\"Permission denied\");\n    log.blank();\n    log.warn(\"Fix permissions with:\");\n    for (const dir of failedDirs) {\n      const parentDir = join(dir, \"..\");\n      log.dim(`  sudo chown -R $(whoami) \"${parentDir}\"`);\n    }\n    log.blank();\n    return;\n  }\n\n  installSpinner.succeed(`Installed ${installedSkills.length} skill(s)`);\n  trackEvent(\"install\", { skills: installedSkills, ides: targets.ides });\n","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/upstash/context7/blob/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/skill.ts#L439-L475","documentation":"A warning logged by the skill install loop in `skill install` when writing a downloaded skill to its target directory throws. The catch block extracts the Error message and logs it per-skill, so one bad skill doesn't abort the whole batch. EACCES/EPERM are skipped here (handled separately as a permission summary).","triggerScenarios":"Any non-permission filesystem error inside the install loop of installCommand: invalid target path, ENOSPC disk full, symlink creation failure, or a skill download writing to a read-only directory.","commonSituations":"Target skill directory is a file instead of a directory; disk full; filesystem doesn't support symlinks (Windows without privileges); corrupted skill package path.","solutions":["Read the logged errMsg to identify the OS error code","Verify the target skill directory exists, is a directory, and is writable","Free disk space if the error is ENOSPC","Re-run the install command; other skills in the batch continue independently"],"exampleFix":"// before\nmkdirSync(targetDir) // may fail if parent missing or path is a file\n// after\nif (statSync(targetDir).isDirectory()) { mkdirSync(targetDir, { recursive: true }) }","handlingStrategy":"try-catch","validationCode":"const st = statSync(targetDir); if (!st.isDirectory()) throw new Error(`${targetDir} is not a directory`); accessSync(targetDir, W_OK);","typeGuard":"function isErrnoException(e: unknown): e is NodeJS.ErrnoException { return e instanceof Error && typeof (e as NodeJS.ErrnoException).code === 'string'; }","tryCatchPattern":"try { installSkill(skill, targetDir); } catch (err) { if (isErrnoException(err) && ['EACCES','EPERM'].includes(err.code)) { recordPermissionError(); return; } log.warn(`Failed to install ${skill.name}: ${err instanceof Error ? err.message : String(err)}`); }","preventionTips":["Pre-check target directories for writability before batch install","Ensure adequate disk space","Avoid symlinks on filesystems that don't support them (Windows FAT)"],"tags":["cli","filesystem","skill-install"],"backgroundTag":"file-write-failed","analyzedSha":"4416fb855b8f752be735e34f943b5d0762701aad","analyzedAt":"2026-09-16T20:28:07.148Z","contentChangedAt":"2026-09-16T20:28:07.148Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}