flipped-aurora/gin-vue-admin · error

技能目录异常

Error message

技能目录异常

What it means

SkillsService.Delete stats the resolved skill path and requires it to be a directory. If the path exists but is a regular file (or other non-directory), it refuses RemoveAll with this error to avoid deleting an unexpected file via the skills API.

Source

Thrown at server/service/system/sys_skills.go:185

	if strings.TrimSpace(req.Tool) == "" {
		return errors.New("工具类型不能为空")
	}
	if !isSafeName(req.Skill) {
		return errors.New("技能名称不合法")
	}
	skillDir, err := s.skillDir(req.Tool, req.Skill)
	if err != nil {
		return err
	}
	info, err := os.Stat(skillDir)
	if err != nil {
		if os.IsNotExist(err) {
			return errors.New("技能不存在")
		}
		return err
	}
	if !info.IsDir() {
		return errors.New("技能目录异常")
	}
	return os.RemoveAll(skillDir)
}

func (s *SkillsService) Package(_ context.Context, req request.SkillPackageRequest) (string, []byte, error) {
	if strings.TrimSpace(req.Tool) == "" {
		return "", nil, errors.New("工具类型不能为空")
	}
	if !isSafeName(req.Skill) {
		return "", nil, errors.New("技能名称不合法")
	}

	skillDir, err := s.skillDir(req.Tool, req.Skill)
	if err != nil {
		return "", nil, err
	}
	info, err := os.Stat(skillDir)
	if err != nil {

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Inspect the path under the tool's skills root and remove/replace the stray file manually.
  2. Restore the skill as a proper directory (re-create or re-import it).
  3. Fix whatever created the file (script, sync tool) and re-run the deletion.

Example fix

// before: deleting a path that is a plain file -> 技能目录异常
// after: verify on disk first
// ls ~/.claude/skills/my-skill  -> must be a directory
// if it's a file: rm the file or restore the directory, then retry Delete
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await api.deleteSkill(req)
} catch (e) {
  if (e.response?.data?.msg === "技能目录异常") {
    notify("目标路径不是技能目录,请检查磁盘上的文件状态")
  }
}

Prevention

When it happens

Trigger: A file (not a directory) exists at the path where the skill directory is expected under the tool's skills root, and Delete is invoked for that skill name.

Common situations: Someone replaced the skill directory with a symlink/file; packaging or copy operations left a stray file with the skill's name; corrupted partial extraction of a skill package.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/afebb6c8d7cee877. Report an issue: GitHub.