{"record":{"id":"f3c8fa624484859f","repo":"larksuite/cli","slug":"w-target-q-w","errorCode":null,"errorMessage":"%w: target %q: %w","messagePattern":"%w: target %q: %w","errorType":"validation","errorClass":"skillref.ErrInvalidRemap","httpStatus":null,"severity":"error","filePath":"internal/skillpolicy/resolver.go","lineNumber":137,"sourceCode":"\t\tcontent = composed\n\t}\n\trefs, err := resolveReferences(content, spec.ReferenceRemaps)\n\tif err != nil {\n\t\treturn Resolution{}, fmt.Errorf(\"plugin %q skill spec: %w\", owner, err)\n\t}\n\treturn Resolution{Content: content, References: refs}, nil\n}\n\nfunc resolveReferences(content fs.FS, remaps []platform.SkillRefRemap) (*skillref.Resolver, error) {\n\tmappings := make([]skillref.Mapping, 0, len(remaps))\n\tfor _, remap := range remaps {\n\t\tfrom, err := skillref.Parse(remap.From())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: source %q: %w\", skillref.ErrInvalidRemap, remap.From(), err)\n\t\t}\n\t\tto, err := skillref.Parse(remap.To())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: target %q: %w\", skillref.ErrInvalidRemap, remap.To(), err)\n\t\t}\n\t\tmappings = append(mappings, skillref.Mapping{From: from, To: to})\n\t}\n\treturn skillref.New(content, mappings)\n}\n\n// distinctOwners returns the unique contributing plugin names in\n// first-seen order. Mirrors cmdpolicy.distinctOwners.\nfunc distinctOwners(specs []PluginSkill) []string {\n\tseen := map[string]bool{}\n\towners := make([]string, 0, len(specs))\n\tfor _, s := range specs {\n\t\tif !seen[s.PluginName] {\n\t\t\tseen[s.PluginName] = true\n\t\t\towners = append(owners, s.PluginName)\n\t\t}\n\t}\n\treturn owners","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/skillpolicy/resolver.go#L119-L155","documentation":"resolveReferences could not parse the remap's target ('To') string into a skill reference; it wraps skillref.ErrInvalidRemap with the offending target and the parse error. Both endpoints of a remap must be canonical skill references.","triggerScenarios":"A ReferenceRemaps entry whose From() parses but whose To() fails skillref.Parse: empty target, invalid characters, or malformed path shape. Reached via ResolveWithReferences when remaps are configured.","commonSituations":"A remap destination typed as a filesystem path ('./guide.md') or containing typos/case errors, often after copying a From line and editing only partially.","solutions":["Read the quoted target value and underlying parse error","Correct To() to a valid canonical skill reference","Add a unit test asserting skillref.Parse succeeds for every remap endpoint","Ensure the target references a skill retained in the composed tree"],"exampleFix":"// before\nplatform.NewSkillRefRemap(\"deploy\", \"Release Guide\")\n// after\nplatform.NewSkillRefRemap(\"deploy\", \"release\")","handlingStrategy":"validation","validationCode":"if _, err := skillref.Parse(remap.To()); err != nil {\n\treturn fmt.Errorf(\"invalid remap target %q: %w\", remap.To(), err)\n}","typeGuard":null,"tryCatchPattern":"_, err := skillpolicy.ResolveWithReferences(base, specs)\nif errors.Is(err, skillref.ErrInvalidRemap) { /* fix To value */ }","preventionTips":["Run skillref.Parse on every To at plugin init","Never use filesystem paths as remap targets","Copy-edit remap pairs as a unit so From/To stay consistent"],"tags":["go","skillref","parsing","remap"],"backgroundTag":"invalid-skill-reference-remap","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"}