larksuite/cli · error · ErrInvalidRemap

%w: whole-skill source %q requires a bare target skill, got

Error message

%w: whole-skill source %q requires a bare target skill, got %q

What it means

Guard in skillref New: a whole-skill remap (source with no path) targets a reference that has a path. Whole-skill remaps may only redirect to a bare skill reference; a path-qualified target is invalid.

Source

Thrown at internal/skillref/resolver.go:61

	}
	seen := make(map[string]bool, len(mappings))
	for _, mapping := range mappings {
		from, to := mapping.From, mapping.To
		if _, err := Parse(from.String()); err != nil {
			return nil, fmt.Errorf("%w: source %q: %w", ErrInvalidRemap, from.String(), err)
		}
		if _, err := Parse(to.String()); err != nil {
			return nil, fmt.Errorf("%w: target %q: %w", ErrInvalidRemap, to.String(), err)
		}
		key := from.String()
		if seen[key] {
			return nil, fmt.Errorf("%w: source %q is mapped more than once", ErrInvalidRemap, key)
		}
		seen[key] = true

		if from.Path == "" {
			if to.Path != "" {
				return nil, fmt.Errorf(
					"%w: whole-skill source %q requires a bare target skill, got %q",
					ErrInvalidRemap, key, to.String())
			}
			r.skills[from.Skill] = to
		} else {
			r.exact[key] = to
		}
		exists, err := probe(content, to)
		if err != nil {
			return nil, fmt.Errorf("%w: cannot inspect target %q: %w",
				ErrInvalidRemap, to.String(), err)
		}
		if !exists {
			return nil, fmt.Errorf("%w: target %q does not exist in the composed skill tree",
				ErrInvalidRemap, to.String())
		}
	}
	return r, nil

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Drop the #path fragment from the target, or add a path to the source to remap a fragment instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/skillref/resolver.go:61 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/7993d0cb3fda0c74. Report an issue: GitHub.