larksuite/cli · error · ErrInvalidRemap

%w: target %q: %w

Error message

%w: target %q: %w

What it means

Resolver.New validates remap mappings and the mapping's target reference failed skillref.Parse; targets are validated because they are build-integrity declarations that must exist. The first %w is ErrInvalidRemap, the second the parse cause.

Source

Thrown at internal/skillref/resolver.go:51

// New validates mappings against content and returns an immutable resolver.
//
// Explicit targets are build-integrity declarations and must exist. In
// contrast, an unmapped canonical reference may be absent: presenters then
// omit the complete guidance fragment that owns it.
func New(content fs.FS, mappings []Mapping) (*Resolver, error) {
	r := &Resolver{
		content: content,
		skills:  make(map[string]Ref),
		exact:   make(map[string]Ref),
	}
	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)

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Correct the target reference to valid `skill` or `skill#path` syntax
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/skillref/resolver.go:51 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/39fd8a7696cb0819. Report an issue: GitHub.