{"record":{"id":"7afa381d11a49c94","repo":"cloudflare/cloudflared","slug":"errnobaseurl","errorCode":"ErrNoBaseURL","errorMessage":"no base url","messagePattern":"no base url","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diagnostic/error.go","lineNumber":21,"sourceCode":"import (\n\t\"errors\"\n)\n\nvar (\n\t// Error used when there is no log directory available.\n\tErrManagedLogNotFound = errors.New(\"managed log directory not found\")\n\t// Error used when it is not possible to collect logs using the log configuration.\n\tErrLogConfigurationIsInvalid = errors.New(\"provided log configuration is invalid\")\n\t// Error used when parsing the fields of the output of collector.\n\tErrInsufficientLines = errors.New(\"insufficient lines\")\n\t// Error used when parsing the lines of the output of collector.\n\tErrInsuficientFields = errors.New(\"insufficient fields\")\n\t// Error used when given key is not found while parsing KV.\n\tErrKeyNotFound = errors.New(\"key not found\")\n\t// Error used when there is no disk volume information available.\n\tErrNoVolumeFound = errors.New(\"no disk volume information found\")\n\t// Error user when the base url of the diagnostic client is not provided.\n\tErrNoBaseURL = errors.New(\"no base url\")\n\t// Error used when no metrics server is found listening to the known addresses list (check [metrics.GetMetricsKnownAddresses]).\n\tErrMetricsServerNotFound = errors.New(\"metrics server not found\")\n\t// Error used when multiple metrics server are found listening to the known addresses list (check [metrics.GetMetricsKnownAddresses]).\n\tErrMultipleMetricsServerFound = errors.New(\"multiple metrics server found\")\n\t// Error used when a temporary file creation fails within the diagnostic procedure\n\tErrCreatingTemporaryFile = errors.New(\"temporary file creation failed\")\n)\n","sourceCodeStart":3,"sourceCodeEnd":29,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/diagnostic/error.go#L3-L29","documentation":"ErrNoBaseURL is returned by the diagnostic httpClient's GET method when a request is attempted while client.baseURL is nil. The diagnostic client was constructed without a base URL, so no endpoint can be resolved. It indicates a client configuration/initialization mistake, not a network failure.","triggerScenarios":"Calling GET (directly or via diagnostic client operations like RetrieveAppState or tunnel data retrieval) on a diagnostic httpClient created without a base URL — e.g. FindMetricsServer produced no usable address or the client was built with a nil *url.URL.","commonSituations":"Constructing diagnostic.NewHTTPClient with a nil URL after metrics discovery failed, reusing a zero-value client struct, or skipping the metrics-server lookup step before making diagnostic requests.","solutions":["Build the client with a valid base URL (e.g. from FindMetricsServer results) before issuing requests.","Check for nil URL when constructing the client and fail fast at construction time.","Ensure the metrics server discovery step succeeded and returned at least one instance address.","Guard call sites with a nil check on the client's base URL before calling GET."],"exampleFix":"// before\nclient := diagnostic.NewHTTPClient(nil, logger)\nresp, err := client.GET(ctx, diagnostic.TunnelStateEndpoint)\n// after\nif baseURL == nil {\n\treturn errors.New(\"diagnostic client requires a base URL\")\n}\nclient := diagnostic.NewHTTPClient(baseURL, logger)\nresp, err := client.GET(ctx, diagnostic.TunnelStateEndpoint)","handlingStrategy":"validation","validationCode":"if client == nil || client.BaseURL() == nil {\n\treturn errors.New(\"diagnostic client has no base URL configured\")\n}","typeGuard":"func hasBaseURL(c *diagnostic.HTTPClient) bool {\n\treturn c != nil && c.BaseURL() != nil\n}","tryCatchPattern":"resp, err := client.GET(ctx, endpoint)\nif errors.Is(err, diagnostic.ErrNoBaseURL) {\n\treturn fmt.Errorf(\"diagnostic client misconfigured: %w\", err)\n}","preventionTips":["Always construct the diagnostic client from a successful FindMetricsServer result.","Fail fast at client construction if the base URL is nil.","Never reuse zero-value client structs across call sites."],"tags":["http-client","configuration","diagnostic"],"backgroundTag":"missing-required-config","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}