{"record":{"id":"48a9cfcd6c401f11","repo":"larksuite/cli","slug":"extenddomain-target-q-does-not-exist","errorCode":null,"errorMessage":"ExtendDomain target %q does not exist","messagePattern":"ExtendDomain target %q does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/commandhost/compile.go","lineNumber":110,"sourceCode":"// service registry rather than deriving domains from shortcuts.AllShortcuts:\n// approval, attendance and mindnotes ship only typed and raw API commands, and\n// a shortcut-derived set would reject them as non-existent.\nfunc businessDomains() map[string]struct{} {\n\tnames := registry.AllServiceNames()\n\tdomains := make(map[string]struct{}, len(names))\n\tfor _, name := range names {\n\t\tdomains[name] = struct{}{}\n\t}\n\treturn domains\n}\n\nfunc validateDomain(domain command.HostDomain, existing map[string]struct{}) error {\n\tname := strings.TrimSpace(domain.Name)\n\tif name == \"\" || name != domain.Name {\n\t\treturn fmt.Errorf(\"domain name must be non-empty and trimmed\")\n\t}\n\tif _, ok := existing[name]; !ok {\n\t\treturn fmt.Errorf(\"ExtendDomain target %q does not exist\", name)\n\t}\n\treturn nil\n}\n\nfunc compileCommand(definition command.HostDefinition) (common.Shortcut, error) {\n\thooks := convertHooks(definition)\n\thooks.NewArgs = definition.NewArgs\n\treturn common.CompileCommandDefinition(commandbridge.Definition{\n\t\tMetadata:   definition.Metadata,\n\t\tInput:      definition.Input,\n\t\tOutput:     definition.Output,\n\t\tArgsType:   definition.ArgsType,\n\t\tDataType:   definition.DataType,\n\t\tHooks:      hooks,\n\t\tPageOutput: definition.PageOutput,\n\t}, commandbridge.Access{})\n}\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/commandhost/compile.go#L92-L128","documentation":"validateDomain, run from CompileSets, found an ExtendDomain declaration whose target domain name is not present in the business-domain set derived from the service registry (approval, attendance, mindnotes and other registered services); only known service domains may be extended.","triggerScenarios":"CompileSets processes a HostDomain whose Name matches nothing in the existing-domains set — the base domain's set was not registered, was registered after the extending set, or is misspelled.","commonSituations":"Typo in the extend target name; reordering registration so the extension set compiles before the base set; removing a domain but leaving its ExtendDomain callers.","solutions":["Register the base domain's command set before the extending set","Fix the Name string to match the existing domain exactly","Remove the ExtendDomain entry if the target domain was intentionally deleted"],"exampleFix":"// before\n{Name: \"docc\", Extend: true} // typo, base is \"doc\"\n// after\n{Name: \"doc\", Extend: true}","handlingStrategy":"validation","validationCode":"registered := map[string]bool{}\nfor _, s := range sets {\n    for _, d := range s.Domains {\n        if d.Extend && !registered[d.Name] {\n            return fmt.Errorf(\"ExtendDomain target %q registered too late\", d.Name)\n        }\n        registered[d.Name] = true\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := commandhost.CompileSets(sets); err != nil {\n    if strings.Contains(err.Error(), \"does not exist\") {\n        return fmt.Errorf(\"base domain missing or out of order: %w\", err)\n    }\n    return err\n}","preventionTips":["Register base domains before extending sets in a single ordered slice","Reference domain names via shared constants, not literals","Test the full registration list order in CI"],"tags":["go","validation","domain-extension"],"backgroundTag":"unknown-extenddomain-target","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"}