{"record":{"id":"66c3b1f5700c38e0","repo":"larksuite/cli","slug":"s-must-equal-v","errorCode":null,"errorMessage":"%s must equal %v","messagePattern":"(.+?) must equal (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_binder.go","lineNumber":410,"sourceCode":"\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"%s does not match any allowed shape\", path)\n\tcase typedNullShape:\n\t\tif value != nil {\n\t\t\treturn fmt.Errorf(\"%s must be null\", path)\n\t\t}\n\t\treturn nil\n\tcase typedConstShape:\n\t\texpectedJSON, err := json.Marshal(constraint.Value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s has invalid const: %w\", path, err)\n\t\t}\n\t\texpected, err := decodeJSONValidationValue(expectedJSON)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s has invalid const: %w\", path, err)\n\t\t}\n\t\tif !reflect.DeepEqual(value, expected) {\n\t\t\treturn fmt.Errorf(\"%s must equal %v\", path, constraint.Value)\n\t\t}\n\t\treturn nil\n\tcase typedStringShape:\n\t\ttext, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be a string\", path)\n\t\t}\n\t\tlength := len([]rune(text))\n\t\tif constraint.MinLength != nil && length < *constraint.MinLength {\n\t\t\treturn fmt.Errorf(\"%s must contain at least %d characters\", path, *constraint.MinLength)\n\t\t}\n\t\tif constraint.MaxLength != nil && length > *constraint.MaxLength {\n\t\t\treturn fmt.Errorf(\"%s must contain at most %d characters\", path, *constraint.MaxLength)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, text) {\n\t\t\treturn fmt.Errorf(\"%s must be one of: %s\", path, strings.Join(constraint.Enum, \", \"))\n\t\t}\n\t\treturn nil","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_binder.go#L392-L428","documentation":"A const-shape field must exactly equal (reflect.DeepEqual after JSON round-trip) the declared const value; any other value fails with this message showing the expected value. Thrown by validateJSONValueAgainstShape in the typedConstShape branch when DeepEqual fails.","triggerScenarios":"Supplying any value other than the schema's fixed const for a field, e.g. sending \"v2\" where const is \"v1\", or a value that differs in Go type after JSON decode (2 vs 2.0).","commonSituations":"API version fields, enum-like constants, or method/version discriminators hardcoded in the schema; developers invent their own value or copy an example from a different endpoint version.","solutions":["Set the field exactly to the value shown in the error message (or the schema's const declaration).","Remove the field if your client library should inject the constant automatically.","If the const itself is outdated (API moved on), update the compiled shape definition."],"exampleFix":"// before\nparams.Set(\"api_version\", \"2.x\") // const: \"2.0\"\n\n// after\nparams.Set(\"api_version\", \"2.0\")","handlingStrategy":"validation","validationCode":"if !reflect.DeepEqual(candidate, expectedConst) { return fmt.Errorf(\"value must equal %v\", expectedConst) }","typeGuard":"func equalsConst(v, want any) bool { return reflect.DeepEqual(v, want) }","tryCatchPattern":"if err := binder.Set(\"api_version\", v); err != nil {\n    if strings.Contains(err.Error(), \"must equal\") {\n        return fmt.Errorf(\"use the exact documented constant: %w\", err)\n    }\n    return err\n}","preventionTips":["Copy constant values from schema output, never from memory.","Define constants once in shared code and reference them.","Prefer letting client machinery inject const fields automatically."],"tags":["go","schema-validation","const","shape-constraint"],"backgroundTag":"schema-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"}