upstash/context7 · warning
Fix permissions with:
Error message
Fix permissions with:
What it means
A warning printed by `skill install` after installation fails with EACCES/EPERM on one or more target directories. The spinner fails with 'Permission denied' and this warning heads a list of suggested `sudo chown` commands that give the current user ownership of each failed directory's parent.
Solutions
- Run the suggested fix: sudo chown -R $(whoami) "<parent-dir>" for each printed failed directory, then retry the install
- Install to a target directory the current user owns instead of the system path
- If sudo chown is not appropriate, copy skill files manually into a writable location
- Check ownership first with ls -ld on the failing directory to confirm the culprit
Example fix
// before (install fails with EACCES) $ opencode skill install org/skills Permission denied // after $ sudo chown -R $(whoami) "$HOME/.opencode" $ opencode skill install org/skills # succeeds
Defensive patterns
Strategy: validation
Validate before calling
import { accessSync, W_OK } from 'node:fs';
for (const dir of targetDirs) {
try { accessSync(dir, W_OK); } catch {
console.error(`Not writable: ${dir}. Fix: sudo chown -R $(whoami) "${join(dir, '..')}"`);
}
} Try / catch
try {
await installSkills(skills, targetDirs);
} catch (e) {
if (e.code === 'EACCES' || e.code === 'EPERM') {
console.warn('Fix permissions with: sudo chown -R $(whoami) "<parent-dir>"');
}
throw e;
} Prevention
- Never run installs with sudo; keep user dirs user-owned
- Periodically check ownership of ~/.opencode / ~/.config paths
- Pre-create target dirs as the current user
When it happens
Trigger: The filesystem write (mkdir/copy of skill files) into a target directory (e.g. a global skills dir under a root-owned path) is rejected due to insufficient permissions; permissionError is set and failedDirs is non-empty.
Common situations: Installing global skills into a system-managed path created by sudo/root previously; shared machine where ~/.config or ~/.opencode subdirectories are owned by another user; running with different users across versions so cached dirs got root-owned.
Understand the failure class
Background: "Permission denied" / "Failed to write" file errors: why a library can't write its files to disk (EACCES, EPERM, ENOSPC) and how to fix them — this error's family across 43 libraries.
Related errors
- Failed to install
- Failed to write to
- await describeErrorResponse(response, fallback)
- Cancelled
- Context7 base URL must not contain a query string or…
AI-assisted analysis of upstash/context7@4416fb855b (2026-09-16).
Data as JSON: /api/errors/4b8409e64c09618d.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/commands/skill.ts:464
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 });
const installedNames = selectedSkills.map((s) => s.name);
logInstallSummary(targets, targetDirs, installedNames);
}
async function searchCommand(query: string): Promise<void> {
trackEvent("command", { name: "search" });
log.blank();View on GitHub (pinned to 4416fb855b)