flipped-aurora/gin-vue-admin · error

工具类型不能为空

Error message

工具类型不能为空

What it means

SkillsService.Delete first requires a non-empty Tool field (trimmed). The tool type selects the skills root directory, so without it the target location is ambiguous and the request is rejected with this error.

Source

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

		for _, tool := range req.SyncTools {
			if tool == req.Tool {
				continue
			}
			targetDir, err := s.ensureSkillDir(tool, req.Skill)
			if err != nil {
				return err
			}
			if err := copySkillDir(skillDir, targetDir); err != nil {
				return err
			}
		}
	}
	return nil
}

func (s *SkillsService) Delete(_ context.Context, req request.SkillDeleteRequest) error {
	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("技能目录异常")
	}

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Include the tool type (e.g. 'claude', 'codex') in the delete request.
  2. On the client, disable the delete action until a tool is selected.
  3. Verify the JSON payload field name matches request.SkillDeleteRequest's Tool binding.

Example fix

// before
deleteReq := request.SkillDeleteRequest{Skill: "my-skill"}
// after
deleteReq := request.SkillDeleteRequest{Tool: "claude", Skill: "my-skill"}
Defensive patterns

Strategy: validation

Validate before calling

if (!req.Tool || !req.Tool.trim()) {
  throw new Error("tool is required")
}
await api.deleteSkill(req)

Type guard

func hasTool(req request.SkillDeleteRequest) bool {
	return strings.TrimSpace(req.Tool) != ""
}

Try / catch

try {
  await api.deleteSkill(req)
} catch (e) {
  if (e.response?.data?.msg === "工具类型不能为空") {
    notify("请先选择工具类型")
  }
}

Prevention

When it happens

Trigger: Calling Delete with request.SkillDeleteRequest where Tool is missing or only whitespace (e.g. empty string or spaces).

Common situations: Frontend deletes a skill after the tool selector was cleared; API calls constructed with only the skill name; tool value lost when serializing the request payload.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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