{"record":{"id":"60268e2b217b09c2","repo":"geektutu/7days-golang","slug":"number-of-options-is-more-than-1-60268e","errorCode":null,"errorMessage":"number of options is more than 1","messagePattern":"number of options is more than 1","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gee-rpc/day3-service/client.go","lineNumber":192,"sourceCode":"\t}\n\tclient.send(call)\n\treturn call\n}\n\n// Call invokes the named function, waits for it to complete,\n// and returns its error status.\nfunc (client *Client) Call(serviceMethod string, args, reply interface{}) error {\n\tcall := <-client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done\n\treturn call.Error\n}\n\nfunc parseOptions(opts ...*Option) (*Option, error) {\n\t// if opts is nil or pass nil as parameter\n\tif len(opts) == 0 || opts[0] == nil {\n\t\treturn DefaultOption, nil\n\t}\n\tif len(opts) != 1 {\n\t\treturn nil, errors.New(\"number of options is more than 1\")\n\t}\n\topt := opts[0]\n\topt.MagicNumber = DefaultOption.MagicNumber\n\tif opt.CodecType == \"\" {\n\t\topt.CodecType = DefaultOption.CodecType\n\t}\n\treturn opt, nil\n}\n\nfunc NewClient(conn net.Conn, opt *Option) (*Client, error) {\n\tf := codec.NewCodecFuncMap[opt.CodecType]\n\tif f == nil {\n\t\terr := fmt.Errorf(\"invalid codec type %s\", opt.CodecType)\n\t\tlog.Println(\"rpc client: codec error:\", err)\n\t\treturn nil, err\n\t}\n\t// send options with server\n\tif err := json.NewEncoder(conn).Encode(opt); err != nil {","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/geektutu/7days-golang/blob/cf3644382101dc13e7fd92e8f5c66cabc51bcd3b/gee-rpc/day3-service/client.go#L174-L210","documentation":"Guard in parseOptions: it accepts zero options (default) or exactly one custom option, so passing two or more *Option values is a programming error. It fires at Dial time when the caller supplies more than one option argument.","triggerScenarios":"Thrown at gee-rpc/day3-service/client.go:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass at most one *Option to Dial; modify the single option's fields instead of passing several.","Use geerpc.DefaultOption when no customization is needed and omit options entirely.","Build one Option value that merges all desired settings before calling Dial."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cf3644382101dc13e7fd92e8f5c66cabc51bcd3b","analyzedAt":"2026-09-03T18:31:24.087Z","contentChangedAt":"2026-09-03T18:31:24.087Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}