larksuite/cli · error · ErrInvalidRemap
%w: source %q is mapped more than once
Error message
%w: source %q is mapped more than once
What it means
Guard in skillref New: two mappings share the same source reference key. Duplicate source remaps are ambiguous, so resolver construction fails wrapped in ErrInvalidRemap.
Source
Thrown at internal/skillref/resolver.go:55
// 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)
if err != nil {
return nil, fmt.Errorf("%w: cannot inspect target %q: %w",
ErrInvalidRemap, to.String(), err)
}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Keep exactly one mapping per source reference
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/skillref/resolver.go:55 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/1eecb95baad94406.
Report an issue: GitHub.