{"record":{"id":"7804380e9f349c71","repo":"kataras/iris","slug":"option-s-expected-key-value-separated-by","errorCode":null,"errorMessage":"option: %s: expected key value separated by '='","messagePattern":"option: (.+?): expected key value separated by '='","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"x/sqlx/struct_row.go","lineNumber":81,"sourceCode":"func parseOptions(fieldTag string, c *Column) error {\n\toptions := strings.Split(fieldTag, \",\")\n\tfor _, opt := range options {\n\t\tif opt == \"\" {\n\t\t\tcontinue // skip empty.\n\t\t}\n\n\t\tvar key, value string\n\n\t\tkv := strings.Split(opt, \"=\") // When more options come to play.\n\t\tswitch len(kv) {\n\t\tcase 2:\n\t\t\tkey = kv[0]\n\t\t\tvalue = kv[1]\n\t\tcase 1:\n\t\t\tc.Name = kv[0]\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"option: %s: expected key value separated by '='\", opt)\n\t\t}\n\n\t\tswitch key {\n\t\tcase \"name\":\n\t\t\tc.Name = value\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unexpected tag option: %s\", key)\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":63,"sourceCodeEnd":94,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/x/sqlx/struct_row.go#L63-L94","documentation":"parseOptions parses a struct tag's option string into name/value pairs and expects each option to be `key=value`. An option containing more than one '=' (kv length > 2) cannot be split unambiguously and triggers this error. Tag names with no options (single token) are handled earlier as the column name.","triggerScenarios":"A db tag like `db:\"name=user=name\"` or `db:\"name=x=y\"` — an option value that itself contains '='.","commonSituations":"Typos where '=' was typed twice; pasting options from another ORM syntax; accidental inclusion of SQL expressions in the tag.","solutions":["Rewrite the option with exactly one '=': `db:\"name=users\"`","Remove the extra '=value' portion or quote/encode it in a supported way","Simplify the tag to just the column name if no options are needed"],"exampleFix":"// before\nField string `db:\"name=user=name\"`\n// after\nField string `db:\"name=user_name\"`","handlingStrategy":"validation","validationCode":"for _, opt := range strings.Split(tag, \";\") {\n\tif strings.Count(opt, \"=\") > 1 { return fmt.Errorf(\"tag option %q has multiple '='\", opt) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never embed '=' inside option values","Lint struct tags in CI","Keep tag syntax documented for the team"],"tags":["struct-tags","parsing","registration"],"backgroundTag":"invalid-struct-tag","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}