{"record":{"id":"f551c18834b9654e","repo":"temporalio/temporal","slug":"empty-service","errorCode":null,"errorMessage":"empty Service","messagePattern":"empty Service","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/nexus/nexusrpc/client.go","lineNumber":162,"sourceCode":"//\n// [Nexus HTTP API]: https://github.com/nexus-rpc/api\ntype HTTPClient struct {\n\tbaseHTTPClient\n\tservice        string\n\tserviceBaseURL *url.URL\n}\n\n// NewHTTPClient creates a new [HTTPClient] from provided [HTTPClientOptions].\n// BaseURL and Service are required.\nfunc NewHTTPClient(options HTTPClientOptions) (*HTTPClient, error) {\n\tif options.HTTPCaller == nil {\n\t\toptions.HTTPCaller = http.DefaultClient.Do\n\t}\n\tif options.BaseURL == \"\" {\n\t\treturn nil, errors.New(\"empty BaseURL\")\n\t}\n\tif options.Service == \"\" {\n\t\treturn nil, errors.New(\"empty Service\")\n\t}\n\tvar baseURL *url.URL\n\tvar err error\n\tbaseURL, err = url.Parse(options.BaseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif baseURL.Scheme != \"http\" && baseURL.Scheme != \"https\" {\n\t\treturn nil, fmt.Errorf(\"invalid URL scheme: %s\", baseURL.Scheme)\n\t}\n\tif options.Serializer == nil {\n\t\toptions.Serializer = nexus.DefaultSerializer()\n\t}\n\tif options.FailureConverter == nil {\n\t\toptions.FailureConverter = DefaultFailureConverter()\n\t}\n\treturn &HTTPClient{\n\t\tbaseHTTPClient: baseHTTPClient{","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/nexus/nexusrpc/client.go#L144-L180","documentation":"NewHTTPClient requires HTTPClientOptions.Service to be set; this string identifies the target Nexus service and is used in request paths/metrics. An empty Service means the client cannot address requests correctly, so construction fails with this error after the BaseURL check.","triggerScenarios":"Calling NewHTTPClient with HTTPClientOptions where Service is \"\" while BaseURL is set — e.g. config that supplies an endpoint but not the service name.","commonSituations":"Partial configuration where only the URL was provided; renaming a Nexus service and forgetting to update the client options; tests and helpers (setupCustom, nexusClientForActiveCluster) wiring options from sparse config.","solutions":["Set Service in HTTPClientOptions to the name of the target Nexus service","Fix the config source so the service name is populated","Validate required options (BaseURL and Service) before constructing the client"],"exampleFix":"// before\nopts := nexusrpc.HTTPClientOptions{BaseURL: endpoint}\n// after\nopts := nexusrpc.HTTPClientOptions{BaseURL: endpoint, Service: \"nexus-test-service\"}","handlingStrategy":"validation","validationCode":"func validateHTTPOptions(opts nexusrpc.HTTPClientOptions) error {\n    if opts.Service == \"\" { return errors.New(\"Service required\") }\n    return nil\n}","typeGuard":"func hasService(opts nexusrpc.HTTPClientOptions) bool { return opts.Service != \"\" }","tryCatchPattern":"client, err := nexusrpc.NewHTTPClient(opts)\nif err != nil && strings.Contains(err.Error(), \"empty Service\") {\n    return nil, fmt.Errorf(\"nexus service name not configured: %w\", err)\n}","preventionTips":["Keep BaseURL and Service in the same config block so they are set together","Reference service names via constants instead of ad-hoc strings","Validate the full HTTPClientOptions struct in one place before constructing clients"],"tags":["nexus","http-client","configuration"],"backgroundTag":"missing-config-value","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}