{"id":"1fe58940d4dbf419","repo":"jackc/pgx","slug":"duplicate-structargs-key-q","errorCode":null,"errorMessage":"duplicate StructArgs key %q","messagePattern":"duplicate StructArgs key %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"named_args.go","lineNumber":112,"sourceCode":"\tout := make(map[string]any, t.NumField())\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tsf := t.Field(i)\n\n\t\t// Ignore unexported fields.\n\t\tif sf.PkgPath != \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tkey, ok, err := dbTagKey(sf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, exists := out[key]; exists {\n\t\t\treturn nil, fmt.Errorf(\"duplicate StructArgs key %q\", key)\n\t\t}\n\n\t\tout[key] = v.Field(i).Interface()\n\t}\n\n\treturn out, nil\n}\n\n// dbTagKey derives the named-argument key for a struct field. Tag parsing matches\n// RowToStructByName* in rows.go (structTagKey, Lookup, comma options, db:\"-\").\n// Anonymous embedded structs are skipped without flattening (unlike row scanning).\nfunc dbTagKey(sf reflect.StructField) (key string, ok bool, err error) {\n\tif sf.Anonymous {\n\t\tft := sf.Type\n\t\tif ft.Kind() == reflect.Pointer {\n\t\t\tft = ft.Elem()\n\t\t}\n\t\tif ft.Kind() == reflect.Struct {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/named_args.go#L94-L130","documentation":"Error \"duplicate StructArgs key %q\" thrown in jackc/pgx.","triggerScenarios":"Thrown at named_args.go:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}