{"record":{"id":"81b936a05687dc03","repo":"larksuite/cli","slug":"metadata-command-q-must-be-one-trimmed-command-se","errorCode":null,"errorMessage":"Metadata.Command %q must be one trimmed command segment","messagePattern":"Metadata\\.Command %q must be one trimmed command segment","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compiler.go","lineNumber":101,"sourceCode":"\tmetadata.Authorization.Identities = identities\n\tmetadata.Authorization.IdentityOrder = append([]typedIdentity(nil), metadata.Authorization.IdentityOrder...)\n\treturn metadata\n}\n\nfunc validateCommandMetadata(metadata typedCommandMetadata) error {\n\tservice := strings.TrimSpace(string(metadata.Service))\n\tif service == \"\" {\n\t\treturn fmt.Errorf(\"Metadata.Service is required\")\n\t}\n\tif service != string(metadata.Service) || strings.ContainsAny(service, \" \\t\\r\\n/\") {\n\t\treturn fmt.Errorf(\"Metadata.Service %q must be one trimmed command segment\", metadata.Service)\n\t}\n\tcommand := strings.TrimSpace(metadata.Command)\n\tif command == \"\" {\n\t\treturn fmt.Errorf(\"Metadata.Command is required\")\n\t}\n\tif command != metadata.Command || strings.ContainsAny(command, \" \\t\\r\\n/\") {\n\t\treturn fmt.Errorf(\"Metadata.Command %q must be one trimmed command segment\", metadata.Command)\n\t}\n\tif !strings.HasPrefix(command, \"+\") {\n\t\treturn fmt.Errorf(\"Metadata.Command %q must start with '+'\", metadata.Command)\n\t}\n\tif command == \"+\" {\n\t\treturn fmt.Errorf(\"Metadata.Command must contain a name after '+'\")\n\t}\n\tif strings.TrimSpace(metadata.Description) == \"\" {\n\t\treturn fmt.Errorf(\"Metadata.Description is required\")\n\t}\n\tswitch metadata.Risk {\n\tcase typedRiskRead, typedRiskWrite, typedRiskHighRiskWrite:\n\tdefault:\n\t\treturn fmt.Errorf(\"Metadata.Risk %q is invalid\", metadata.Risk)\n\t}\n\tif len(metadata.Authorization.Identities) == 0 {\n\t\treturn fmt.Errorf(\"Metadata.Authorization.Identities must declare at least one identity\")\n\t}","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compiler.go#L83-L119","documentation":"Compile-time guard in validateCommandMetadata: Metadata.Service is not a single trimmed command segment (untrimmed or contains whitespace/slashes).","triggerScenarios":"Thrown at shortcuts/common/typed_compiler.go:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one trimmed segment without whitespace or slashes"],"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"}