{"record":{"id":"d16229e58ef49d74","repo":"larksuite/cli","slug":"s-params-d-must-be-a-non-blank-trimmed-param","errorCode":null,"errorMessage":"%s.Params[%d] must be a non-blank trimmed param","messagePattern":"(.+?)\\.Params\\[(.+?)\\] must be a non-blank trimmed param","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_contract.go","lineNumber":69,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"Input.Relations[%d] duplicates an earlier relation\", i)\n\t\t}\n\t\tseen[key] = struct{}{}\n\t\tresult = append(result, compiled)\n\t}\n\treturn result, nil\n}\n\nfunc compileAuthorization(definition typedAuthorizationDefinition, fields []compiledInputField, fieldByName map[string]int) error {\n\tfor identity, authorization := range definition.Identities {\n\t\tfor i, conditional := range authorization.ConditionalScopes {\n\t\t\tpath := fmt.Sprintf(\"Authorization.%s.ConditionalScopes[%d]\", identity, i)\n\t\t\tif len(conditional.Params) > 0 && conditional.When == \"\" {\n\t\t\t\treturn fmt.Errorf(\"%s.Params requires agent-readable When text\", path)\n\t\t\t}\n\t\t\tseen := make(map[string]struct{}, len(conditional.Params))\n\t\t\tfor j, param := range conditional.Params {\n\t\t\t\tif param == \"\" || param != strings.TrimSpace(param) {\n\t\t\t\t\treturn fmt.Errorf(\"%s.Params[%d] must be a non-blank trimmed param\", path, j)\n\t\t\t\t}\n\t\t\t\tfieldIndex, ok := fieldByName[param]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fmt.Errorf(\"%s references unknown param --%s\", path, param)\n\t\t\t\t}\n\t\t\t\tif fields[fieldIndex].cli.Hidden {\n\t\t\t\t\treturn fmt.Errorf(\"%s references hidden param --%s; use a public canonical param\", path, param)\n\t\t\t\t}\n\t\t\t\tif _, duplicate := seen[param]; duplicate {\n\t\t\t\t\treturn fmt.Errorf(\"%s.Params contains duplicate param --%s\", path, param)\n\t\t\t\t}\n\t\t\t\tseen[param] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_contract.go#L51-L87","documentation":"Thrown when a param entry in Authorization conditional scopes is empty or has leading/trailing whitespace. Param names must be non-blank and trimmed so they can be matched exactly against compiled input fields.","triggerScenarios":"ConditionalScopes entry with Params containing \"\" or \" --doc-id \" (untrimmed).","commonSituations":"Building param lists from split strings without trimming; placeholder empty strings left in scaffolding; trailing comma/space artifacts in hand-edited slices.","solutions":["Trim whitespace or remove the blank entry from Params","strings.TrimSpace each element when params are derived from user-supplied config"],"exampleFix":"// before\nParams: strings.Split(\"--chat-id, --message-id\", \",\") // [\"--chat-id\", \" --message-id\"]\n// after\nParams: []string{\"--chat-id\", \"--message-id\"} // pre-trimmed literals","handlingStrategy":"validation","validationCode":"for j, p := range cs.Params {\n  if strings.TrimSpace(p) == \"\" || p != strings.TrimSpace(p) {\n    return fmt.Errorf(\"param %d must be trimmed and non-blank\", j)\n  }\n}","typeGuard":null,"tryCatchPattern":"if err := common.CompileTypedDefinition(def); err != nil {\n  return fmt.Errorf(\"untrimmed param in conditional scopes: %w\", err)\n}","preventionTips":["Always strings.TrimSpace elements derived from split/config strings","Use literal flag names, not strings built at runtime","Keep param lists as code literals reviewed in diffs"],"tags":["go","authorization","scopes","validation"],"backgroundTag":"shortcut-definition-validation-failed","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"}