{"record":{"id":"c9f1e0b9573902f5","repo":"go-playground/validator","slug":"bad-field-name-provided-s","errorCode":null,"errorMessage":"Bad field name provided %s","messagePattern":"Bad field name provided (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baked_in.go","lineNumber":480,"sourceCode":"\t\t\t\t\tkey = val.Elem().Interface() // <-- compare underlying value\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tkey = val.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{}{}\n\t\t}\n\n\t\treturn true\n\n\tdefault:\n\t\tif parent := fl.Parent(); parent.Kind() == reflect.Struct {\n\t\t\tuniqueField := parent.FieldByName(param)\n\t\t\tif !uniqueField.IsValid() {\n\t\t\t\tpanic(fmt.Sprintf(\"Bad field name provided %s\", param))\n\t\t\t}\n\n\t\t\tif uniqueField.Kind() != field.Kind() {\n\t\t\t\tpanic(fmt.Sprintf(\"Bad field type %s:%s\", field.Type(), uniqueField.Type()))\n\t\t\t}\n\n\t\t\treturn getValue(field) != getValue(uniqueField)\n\t\t}\n\n\t\tpanic(fmt.Sprintf(\"Bad field type %s\", field.Type()))\n\t}\n}\n\n// isMAC is the validation function for validating if the field's value is a valid MAC address.\nfunc isMAC(fl FieldLevel) bool {\n\t_, err := net.ParseMAC(fl.Field().String())\n\n\treturn err == nil","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/go-playground/validator/blob/facf128d2eecf42bd4ff447adc961aa21bb64aed/baked_in.go#L462-L498","documentation":"Panics inside isUnique's default branch (non-slice fields) when the parent struct has no field whose name matches the unique tag parameter. parent.FieldByName(param) returns an invalid value, meaning the unique=OtherField tag references a sibling field that does not exist on the struct being validated — a tag configuration error, not a data error.","triggerScenarios":"Thrown at baked_in.go:480 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the unique tag parameter to reference an existing sibling field name (case-sensitive)","Add the referenced field to the struct if it is missing","Update unique tags whenever referenced fields are renamed"],"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"}