{"record":{"id":"5579aa8cff84651e","repo":"go-gorm/gorm","slug":"the-composite-tag-of-s-s-cannot-be-empty","errorCode":null,"errorMessage":"the composite tag of %s.%s cannot be empty","messagePattern":"the composite tag of (.+?)\\.(.+?) cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"schema/index.go","lineNumber":124,"sourceCode":"\t\t\t\t\tname       string\n\t\t\t\t\ttag        = strings.Join(v[1:], \":\")\n\t\t\t\t\tidx        = strings.IndexByte(tag, ',')\n\t\t\t\t\ttagSetting = strings.Join(strings.Split(tag, \",\")[1:], \",\")\n\t\t\t\t\tsettings   = ParseTagSetting(tagSetting, \",\")\n\t\t\t\t\tlength, _  = strconv.Atoi(settings[\"LENGTH\"])\n\t\t\t\t)\n\n\t\t\t\tif idx == -1 {\n\t\t\t\t\tidx = len(tag)\n\t\t\t\t}\n\n\t\t\t\tname = tag[0:idx]\n\t\t\t\tif name == \"\" {\n\t\t\t\t\tsubName := field.Name\n\t\t\t\t\tconst key = \"COMPOSITE\"\n\t\t\t\t\tif composite, found := settings[key]; found {\n\t\t\t\t\t\tif len(composite) == 0 || composite == key {\n\t\t\t\t\t\t\terr = fmt.Errorf(\n\t\t\t\t\t\t\t\t\"the composite tag of %s.%s cannot be empty\",\n\t\t\t\t\t\t\t\tfield.Schema.Name,\n\t\t\t\t\t\t\t\tfield.Name)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsubName = composite\n\t\t\t\t\t}\n\t\t\t\t\tname = field.Schema.namer.IndexName(\n\t\t\t\t\t\tfield.Schema.Table, subName)\n\t\t\t\t}\n\n\t\t\t\tif (k == \"UNIQUEINDEX\") || settings[\"UNIQUE\"] != \"\" {\n\t\t\t\t\tsettings[\"CLASS\"] = \"UNIQUE\"\n\t\t\t\t}\n\n\t\t\t\tpriority, err := strconv.Atoi(settings[\"PRIORITY\"])\n\t\t\t\tif err != nil {\n\t\t\t\t\tpriority = 10","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/go-gorm/gorm/blob/1d6ce99528060be18a42be09aca8d39efcb47f28/schema/index.go#L106-L142","documentation":"Error \"the composite tag of %s.%s cannot be empty\" thrown in go-gorm/gorm.","triggerScenarios":"Thrown at schema/index.go:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a non-empty composite value in the index tag, e.g. `gorm:\"index:,composite:idx_name\"`.","Remove the empty composite option from the tag.","Ensure all fields sharing the composite index use the same composite name."],"exampleFix":"Provide a non-empty composite value in the index tag: `gorm:\"index:idx_name,composite:col1\"`.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1d6ce99528060be18a42be09aca8d39efcb47f28","analyzedAt":"2026-08-15T13:01:23.433Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}