{"record":{"id":"615a9770536aa739","repo":"larksuite/cli","slug":"command-set-d-w","errorCode":null,"errorMessage":"command set %d: %w","messagePattern":"command set (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/commandhost/compile.go","lineNumber":42,"sourceCode":"// CompileSets validates and compiles a complete external contribution without registration.\nfunc CompileSets(sets []command.Set) ([]common.Shortcut, error) {\n\tsets = command.CloneSets(sets)\n\tif len(sets) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tbuiltins := shortcuts.AllShortcuts()\n\tpaths := make(map[string]string, len(builtins))\n\tfor _, shortcut := range builtins {\n\t\tpaths[shortcut.Service+\" \"+shortcut.Command] = \"built-in command\"\n\t}\n\texistingDomains := businessDomains()\n\n\tcompiled := make([]common.Shortcut, 0)\n\tfor setIndex, set := range sets {\n\t\tdomain := command.InspectDomain(set.Domain)\n\t\tif err := validateDomain(domain, existingDomains); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"command set %d: %w\", setIndex+1, err)\n\t\t}\n\t\tif len(set.Commands) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"command set %d for domain %q has no commands\", setIndex+1, domain.Name)\n\t\t}\n\t\tfor commandIndex, declaration := range set.Commands {\n\t\t\tdefinition := command.InspectCommand(declaration)\n\t\t\tif string(definition.Metadata.Service) != domain.Name {\n\t\t\t\treturn nil, fmt.Errorf(\"command set %d command %d: Metadata.Service %q does not match domain %q\",\n\t\t\t\t\tsetIndex+1, commandIndex+1, definition.Metadata.Service, domain.Name)\n\t\t\t}\n\t\t\tshortcutPath := string(definition.Metadata.Service) + \" \" + definition.Metadata.Command\n\t\t\tif owner, duplicate := paths[shortcutPath]; duplicate {\n\t\t\t\treturn nil, fmt.Errorf(\"command set %d command %d: command path %q conflicts with %s\",\n\t\t\t\t\tsetIndex+1, commandIndex+1, shortcutPath, owner)\n\t\t\t}\n\t\t\tshortcut, err := compileCommand(definition)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"command set %d command %d (%s): %w\", setIndex+1, commandIndex+1, shortcutPath, err)","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/commandhost/compile.go#L24-L60","documentation":"CompileSets validates each registered shortcut command set; when validateDomain rejects the set's domain (unknown/duplicate/inconsistent with existing business domains), it wraps the cause as \"command set %d: %w\" with a 1-based set index. This is a developer-time registration/compile failure, not a runtime API error.","triggerScenarios":"Adding a shortcut whose set.Domain fails validateDomain (unregistered domain, conflicting with existingDomains) so shortcut compilation at startup/registration returns this error.","commonSituations":"Registering a new shortcuts/<domain> set with a domain not declared via command.InspectDomain; a domain name typo; two packages claiming overlapping domains during plugin/extension registration.","solutions":["Read the wrapped cause for the exact domain rule violated","Register/declare the domain correctly before compiling the set","Fix the domain name to match the declared business domain","Ensure only one set owns a given domain across the binary"],"exampleFix":"// before\ncommon.ShortcutSet{Domain: myDomainPkg.Undeclared}\n// after\ncommon.ShortcutSet{Domain: myDomainPkg.Domain}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["command-registration","shortcut","compile"],"backgroundTag":"invalid-command-domain","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"}