{"record":{"id":"25a8da1525ced244","repo":"larksuite/cli","slug":"invalid-requiredcliversion-q-w","errorCode":null,"errorMessage":"invalid RequiredCLIVersion %q: %w","messagePattern":"invalid RequiredCLIVersion %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/platform/version.go","lineNumber":61,"sourceCode":"// Returns false and an error when constraint is malformed -- callers\n// should treat parse errors as fail-closed so an authoring mistake in\n// the plugin does not silently load against the wrong CLI version.\n//\n// **Order of checks**: constraint syntax is validated FIRST, before the\n// DEV-build short-circuit. A malformed constraint is a plugin authoring\n// bug; we surface it even on DEV builds so the typo can be caught\n// during plugin development instead of waiting for the first tagged\n// release to expose it.\nfunc satisfiesRequiredCLIVersion(buildVersion, constraint string) (bool, error) {\n\tconstraint = strings.TrimSpace(constraint)\n\tif constraint == \"\" {\n\t\treturn true, nil\n\t}\n\n\top, rhs := splitConstraint(constraint)\n\trv, err := parseSemverPrefix(rhs)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"invalid RequiredCLIVersion %q: %w\", constraint, err)\n\t}\n\n\tif buildVersion == \"\" || buildVersion == \"DEV\" {\n\t\treturn true, nil\n\t}\n\n\tbv, err := parseSemverPrefix(buildVersion)\n\tif err != nil {\n\t\t// Build version is unparseable -- treat as DEV so an exotic\n\t\t// build tag doesn't lock plugins out.\n\t\treturn true, nil //nolint:nilerr // intentional fail-open for unparseable buildVersion\n\t}\n\tcmp := compareSemver(bv, rv)\n\tswitch op {\n\tcase \"=\", \"\":\n\t\treturn cmp == 0, nil\n\tcase \">=\":\n\t\treturn cmp >= 0, nil","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/platform/version.go#L43-L79","documentation":"satisfiesRequiredCLIVersion parses a plugin's RequiredCLIVersion constraint; if the version suffix after the operator fails parseSemverPrefix, it reports \"invalid RequiredCLIVersion %q: %w\" with the parse error. It protects installOne from installing a plugin whose version constraint is malformed.","triggerScenarios":"Installing a plugin whose manifest declares RequiredCLIVersion in a non-semver form after the operator — e.g. \"1.2\", \"v1.2.x-beta.3+meta\", \"1.2.3.4\", or an empty/garbled value.","commonSituations":"Hand-edited plugin manifests; a plugin author bumped versions with a tool emitting unsupported formats; copy-pasted constraints from another ecosystem (npm/cargo style ranges).","solutions":["Fix the plugin manifest's RequiredCLIVersion to a supported form: optional operator (\"\", \"=\", \">=\", \">\", \"<=\", \"<\") plus a valid semver prefix like 1.2 or 1.2.3.","Check the wrapped parse error (%w) to see exactly what the parser rejected.","Use a released plugin version with a valid manifest.","If you author plugins, add manifest validation to your release pipeline."],"exampleFix":"// before\n\"RequiredCLIVersion\": \"1.2.x || ^2\"\n// after\n\"RequiredCLIVersion\": \">=1.2\"","handlingStrategy":"validation","validationCode":"var rvRe = regexp.MustCompile(`^(>=|<=|>|<|=)?\\d+(\\.\\d+)?(\\.\\d+)?$`)\nfunc validConstraint(c string) bool { return rvRe.MatchString(c) }\n// check before install: validConstraint(plugin.RequiredCLIVersion)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate manifests in your plugin release pipeline","Use only the supported grammar: optional comparator + semver prefix (1.2 / 1.2.3)","Avoid cross-ecosystem range syntax (^, ~, ||, x-ranges) in RequiredCLIVersion"],"tags":["plugins","versioning","validation","manifest"],"backgroundTag":"invalid-version-constraint","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"}