{"record":{"id":"39fd8a7696cb0819","repo":"larksuite/cli","slug":"w-target-q-w-39fd8a","errorCode":null,"errorMessage":"%w: target %q: %w","messagePattern":"%w: target %q: %w","errorType":"validation","errorClass":"ErrInvalidRemap","httpStatus":null,"severity":"error","filePath":"internal/skillref/resolver.go","lineNumber":51,"sourceCode":"// New validates mappings against content and returns an immutable resolver.\n//\n// Explicit targets are build-integrity declarations and must exist. In\n// contrast, an unmapped canonical reference may be absent: presenters then\n// omit the complete guidance fragment that owns it.\nfunc New(content fs.FS, mappings []Mapping) (*Resolver, error) {\n\tr := &Resolver{\n\t\tcontent: content,\n\t\tskills:  make(map[string]Ref),\n\t\texact:   make(map[string]Ref),\n\t}\n\tseen := make(map[string]bool, len(mappings))\n\tfor _, mapping := range mappings {\n\t\tfrom, to := mapping.From, mapping.To\n\t\tif _, err := Parse(from.String()); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: source %q: %w\", ErrInvalidRemap, from.String(), err)\n\t\t}\n\t\tif _, err := Parse(to.String()); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: target %q: %w\", ErrInvalidRemap, to.String(), err)\n\t\t}\n\t\tkey := from.String()\n\t\tif seen[key] {\n\t\t\treturn nil, fmt.Errorf(\"%w: source %q is mapped more than once\", ErrInvalidRemap, key)\n\t\t}\n\t\tseen[key] = true\n\n\t\tif from.Path == \"\" {\n\t\t\tif to.Path != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\"%w: whole-skill source %q requires a bare target skill, got %q\",\n\t\t\t\t\tErrInvalidRemap, key, to.String())\n\t\t\t}\n\t\t\tr.skills[from.Skill] = to\n\t\t} else {\n\t\t\tr.exact[key] = to\n\t\t}\n\t\texists, err := probe(content, to)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/skillref/resolver.go#L33-L69","documentation":"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.","triggerScenarios":"Thrown at internal/skillref/resolver.go:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the target reference to valid `skill` or `skill#path` syntax"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}