{"record":{"id":"0de22ccce116f3de","repo":"go-playground/validator","slug":"bad-field-name-s","errorCode":null,"errorMessage":"Bad field name %s","messagePattern":"Bad field name (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baked_in.go","lineNumber":427,"sourceCode":"\n\t\t\tif elem.Kind() == reflect.Ptr {\n\t\t\t\tif elem.IsNil() {\n\t\t\t\t\tif _, ok := seen[nilKey]; ok {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tseen[nilKey] = struct{}{}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\telem = elem.Elem()\n\t\t\t}\n\n\t\t\tif elem.Kind() != reflect.Struct {\n\t\t\t\tpanic(fmt.Sprintf(\"Bad field type %s\", elem.Type()))\n\t\t\t}\n\n\t\t\tsf := elem.FieldByName(param)\n\t\t\tif !sf.IsValid() {\n\t\t\t\tpanic(fmt.Sprintf(\"Bad field name %s\", param))\n\t\t\t}\n\n\t\t\tvar key interface{}\n\n\t\t\tif sf.Kind() == reflect.Ptr {\n\t\t\t\tif sf.IsNil() {\n\t\t\t\t\tkey = nilKey\n\t\t\t\t} else {\n\t\t\t\t\tkey = sf.Elem().Interface()\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tkey = sf.Interface()\n\t\t\t}\n\n\t\t\tif _, ok := seen[key]; ok {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tseen[key] = struct{}{}","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/go-playground/validator/blob/facf128d2eecf42bd4ff447adc961aa21bb64aed/baked_in.go#L409-L445","documentation":"Panics inside the isUnique validator's slice-of-struct branch when the parameter naming the key field does not exist on the struct elements. After resolving each element to a struct, FieldByName(param) returns an invalid value because the tag parameter names a field that is not present on that struct; the guard panics to signal a misconfigured unique=FieldName tag rather than silently passing.","triggerScenarios":"Thrown at baked_in.go:427 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the unique tag parameter to match an actual field name on the struct (case-sensitive)","Add the missing key field to the struct if it was intended","Keep the field name in sync when renaming struct fields used by unique tags"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"facf128d2eecf42bd4ff447adc961aa21bb64aed","analyzedAt":"2026-09-02T10:19:04.986Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}