larksuite/cli · error
ExtendDomain target %q does not exist
Error message
ExtendDomain target %q does not exist
What it means
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.
Source
Thrown at internal/commandhost/compile.go:110
// service registry rather than deriving domains from shortcuts.AllShortcuts:
// approval, attendance and mindnotes ship only typed and raw API commands, and
// a shortcut-derived set would reject them as non-existent.
func businessDomains() map[string]struct{} {
names := registry.AllServiceNames()
domains := make(map[string]struct{}, len(names))
for _, name := range names {
domains[name] = struct{}{}
}
return domains
}
func validateDomain(domain command.HostDomain, existing map[string]struct{}) error {
name := strings.TrimSpace(domain.Name)
if name == "" || name != domain.Name {
return fmt.Errorf("domain name must be non-empty and trimmed")
}
if _, ok := existing[name]; !ok {
return fmt.Errorf("ExtendDomain target %q does not exist", name)
}
return nil
}
func compileCommand(definition command.HostDefinition) (common.Shortcut, error) {
hooks := convertHooks(definition)
hooks.NewArgs = definition.NewArgs
return common.CompileCommandDefinition(commandbridge.Definition{
Metadata: definition.Metadata,
Input: definition.Input,
Output: definition.Output,
ArgsType: definition.ArgsType,
DataType: definition.DataType,
Hooks: hooks,
PageOutput: definition.PageOutput,
}, commandbridge.Access{})
}
View on GitHub (pinned to 7fd6ef3c07)
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
Example fix
// before
{Name: "docc", Extend: true} // typo, base is "doc"
// after
{Name: "doc", Extend: true} Defensive patterns
Strategy: validation
Validate before calling
registered := map[string]bool{}
for _, s := range sets {
for _, d := range s.Domains {
if d.Extend && !registered[d.Name] {
return fmt.Errorf("ExtendDomain target %q registered too late", d.Name)
}
registered[d.Name] = true
}
} Try / catch
if err := commandhost.CompileSets(sets); err != nil {
if strings.Contains(err.Error(), "does not exist") {
return fmt.Errorf("base domain missing or out of order: %w", err)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid column: {column!r}
- Invalid column index: {index}
- anchor outside sheet: {position!r}
- Missing row_count/column_count for sheet {sheet_title(sheet)
- Missing sheet_id for sheet {title!r}
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/48a9cfcd6c401f11.
Report an issue: GitHub.