siyuan-note/siyuan · error
user skill is read-only
Error message
user skill is read-only: %s
What it means
RemoveSkill can only delete skills located in SkillsDir(); if the named skill exists only under UserSkillsDir() it is considered read-only and this error is returned instead of deleting it. User skills are managed externally and protected from removal through this API.
Solutions
- Only remove skills that live in SkillsDir()
- Check which directory the skill resides in before attempting removal
- Manage user skills through their own provisioning mechanism, not RemoveSkill
- Skip user skills in bulk-cleanup scripts by checking location first
Example fix
// before
err := RemoveSkill("builtin-helper") // user skill
// after
if isUserSkill("builtin-helper") {
// manage via user skill provisioning, not RemoveSkill
} else {
err := RemoveSkill("builtin-helper")
} Defensive patterns
Strategy: validation
Validate before calling
const userSkills = readSkillRecords(UserSkillsDir()).map(r => r.name);
if (userSkills.includes(name)) throw new Error(`'${name}' is a read-only user skill; cannot remove`); Try / catch
try {
await removeSkill(name);
} catch (e) {
if (String(e.message).startsWith("user skill is read-only")) {
// surface to user: manage user skills through provisioning, not removal
}
} Prevention
- Check the skill's source directory before attempting removal
- Exclude user skills from bulk-delete operations
- Document which skills are externally managed
When it happens
Trigger: Calling RemoveSkill(name) where name is absent from SkillsDir() records but present in UserSkillsDir() records.
Common situations: Attempting to delete a built-in or user-provisioned skill through the management API; scripts cleaning up all skills indiscriminately; mistaking user skills for editable ones.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- Conf.Language(14) (copy resource failed: )
- Conf.Language(34)
- create a skill before creating its subdirectories
- create AI editor actions directory failed
- create conf dir failed
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/4dcc061e77c67a99.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/util/skill.go:448
}
skillDir := filepath.Join(dir, name)
if err := os.MkdirAll(skillDir, 0755); err != nil {
return err
}
skillMdPath := filepath.Join(skillDir, "SKILL.md")
return filelock.WriteFile(skillMdPath, []byte(content))
}
func RemoveSkill(name string) error {
skillManagementLock.Lock()
defer skillManagementLock.Unlock()
if err := validateSkillName(name); err != nil {
return err
}
record, ok := findSkillRecord(readSkillRecords(SkillsDir()), name)
if !ok {
if _, found := findSkillRecord(readSkillRecords(UserSkillsDir()), name); found {
return fmt.Errorf("user skill is read-only: %s", name)
}
return fmt.Errorf("skill not found: %s", name)
}
skillDir := filepath.Join(record.Root, record.DirName)
return os.RemoveAll(skillDir)
}
func RenameSkill(oldName, newName string) error {
skillManagementLock.Lock()
defer skillManagementLock.Unlock()
if err := validateSkillName(oldName); err != nil {
return err
}
if err := validateSkillName(newName); err != nil {
return err
}
dir := SkillsDir()
record, ok := findSkillRecord(readSkillRecords(dir), oldName)View on GitHub (pinned to 9f775e8a12)