{"record":{"id":"1e5cfc220c0fcf0a","repo":"temporalio/temporal","slug":"empty-baseurl","errorCode":null,"errorMessage":"empty BaseURL","messagePattern":"empty BaseURL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/nexus/nexusrpc/client.go","lineNumber":159,"sourceCode":"//\n// OperationHandles can be obtained either by starting new operations or by calling [HTTPClient.NewOperationHandle] for\n// existing operations.\n//\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()","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/nexus/nexusrpc/client.go#L141-L177","documentation":"NewHTTPClient in common/nexus/nexusrpc/client.go requires HTTPClientOptions.BaseURL to be set; when it is empty the client cannot parse a target URL and returns this error immediately. BaseURL is the endpoint of the remote Nexus endpoint/service all requests will be sent to.","triggerScenarios":"Calling NewHTTPClient with HTTPClientOptions where BaseURL is \"\" — typically from setupCustom, nexusClientForActiveCluster, or config-driven construction where the endpoint setting was missing.","commonSituations":"Missing or misnamed config key for the Nexus endpoint; environment variable not set so the endpoint string stays empty; running against a cluster that has not been configured with Nexus endpoints.","solutions":["Set HTTPClientOptions.BaseURL to the full Nexus endpoint URL (e.g. http://host:port) before calling NewHTTPClient","Fix the config/env source so the endpoint value is actually loaded","Validate options.BaseURL is non-empty at startup to fail fast with a clearer message"],"exampleFix":"// before\nclient, err := nexusrpc.NewHTTPClient(nexusrpc.HTTPClientOptions{Service: \"test\"})\n// after\nclient, err := nexusrpc.NewHTTPClient(nexusrpc.HTTPClientOptions{\n    Service: \"test\",\n    BaseURL: cfg.NexusEndpointURL, // e.g. \"http://127.0.0.1:7243\"\n})","handlingStrategy":"validation","validationCode":"func validateHTTPOptions(opts nexusrpc.HTTPClientOptions) error {\n    if opts.BaseURL == \"\" { return errors.New(\"BaseURL required\") }\n    if _, err := url.Parse(opts.BaseURL); err != nil { return err }\n    return nil\n}","typeGuard":"func hasBaseURL(opts nexusrpc.HTTPClientOptions) bool { return opts.BaseURL != \"\" }","tryCatchPattern":"client, err := nexusrpc.NewHTTPClient(opts)\nif err != nil && strings.Contains(err.Error(), \"empty BaseURL\") {\n    return nil, fmt.Errorf(\"nexus endpoint URL not configured (set BaseURL): %w\", err)\n}","preventionTips":["Fail fast at service startup if the Nexus endpoint config value is empty","Name config keys clearly and log which env var/config key the BaseURL came from","Provide sane defaults or explicit errors in config loaders for missing endpoints"],"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"}