upstash/context7 · warning

Failed to install

Error message

Failed to install ${skill.name}: ${errMsg}

What it means

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).

Solutions

  1. Read the logged errMsg to identify the OS error code
  2. Verify the target skill directory exists, is a directory, and is writable
  3. Free disk space if the error is ENOSPC
  4. Re-run the install command; other skills in the batch continue independently

Example fix

// before
mkdirSync(targetDir) // may fail if parent missing or path is a file
// after
if (statSync(targetDir).isDirectory()) { mkdirSync(targetDir, { recursive: true }) }
Defensive patterns

Strategy: try-catch

Validate before calling

const st = statSync(targetDir); if (!st.isDirectory()) throw new Error(`${targetDir} is not a directory`); accessSync(targetDir, W_OK);

Type guard

function isErrnoException(e: unknown): e is NodeJS.ErrnoException { return e instanceof Error && typeof (e as NodeJS.ErrnoException).code === 'string'; }

Try / catch

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)}`); }

Prevention

When it happens

Trigger: 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.

Common situations: Target skill directory is a file instead of a directory; disk full; filesystem doesn't support symlinks (Windows without privileges); corrupted skill package path.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of upstash/context7@4416fb855b (2026-09-16). Data as JSON: /api/errors/fa724e1daf2ba0db. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/commands/skill.ts:457

          await symlinkSkill(skill.name, primarySkillDir, targetDir);
        } catch (dirErr) {
          const error = dirErr as NodeJS.ErrnoException;
          if (error.code === "EACCES" || error.code === "EPERM") {
            permissionError = true;
            failedDirs.add(targetDir);
          }
          throw dirErr;
        }
      }

      installedSkills.push(`${skill.project}/${skill.name}`);
    } catch (err) {
      const error = err as NodeJS.ErrnoException;
      if (error.code === "EACCES" || error.code === "EPERM") {
        continue;
      }
      const errMsg = err instanceof Error ? err.message : String(err);
      log.warn(`Failed to install ${skill.name}: ${errMsg}`);
    }
  }

  if (permissionError) {
    installSpinner.fail("Permission denied");
    log.blank();
    log.warn("Fix permissions with:");
    for (const dir of failedDirs) {
      const parentDir = join(dir, "..");
      log.dim(`  sudo chown -R $(whoami) "${parentDir}"`);
    }
    log.blank();
    return;
  }

  installSpinner.succeed(`Installed ${installedSkills.length} skill(s)`);
  trackEvent("install", { skills: installedSkills, ides: targets.ides });

View on GitHub (pinned to 4416fb855b)