{"record":{"id":"6a261e163115ae24","repo":"SigNoz/signoz","slug":"errcodeinvalidgatewayconfig","errorCode":"ErrCodeInvalidGatewayConfig","errorMessage":"url is required","messagePattern":"url is required","errorType":"error_code","errorClass":"errors.SignozError","httpStatus":400,"severity":"error","filePath":"pkg/gateway/config.go","lineNumber":30,"sourceCode":"}\n\nfunc NewConfigFactory() factory.ConfigFactory {\n\treturn factory.NewConfigFactory(factory.MustNewName(\"gateway\"), newConfig)\n}\n\nfunc newConfig() factory.Config {\n\treturn &Config{\n\t\tURL: &url.URL{\n\t\t\tScheme: \"http\",\n\t\t\tHost:   \"localhost:8080\",\n\t\t\tPath:   \"/\",\n\t\t},\n\t}\n}\n\nfunc (c Config) Validate() error {\n\tif c.URL == nil {\n\t\treturn errors.New(errors.TypeInvalidInput, ErrCodeInvalidGatewayConfig, \"url is required\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":12,"sourceCodeEnd":35,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/gateway/config.go#L12-L35","documentation":"Returned by the gateway Config.Validate when the URL field is nil — the ingestion-gateway client requires an upstream URL to forward data to. It is a startup-time misconfiguration, not a runtime network error.","triggerScenarios":"Constructing gateway.Config without setting URL (nil *url.URL) and calling Validate; typically when the gateway URL env var (e.g. SIGNOZ_INGESTION_GATEWAY_URL) is unset so unmarshalling leaves URL nil.","commonSituations":"Deploying without the gateway URL env var set; yaml config missing the url key under gateway:; typos in the env var name; optional-gateway treated as required after an upgrade.","solutions":["Set the gateway URL in config: gateway.url / corresponding env var (e.g. http://gateway:8080)","If gateway is optional in your topology, skip constructing/validating the gateway config entirely","Add a startup check that fails fast with a clear message when the env var is absent"],"exampleFix":"// before\ncfg := gateway.Config{}\nerr := cfg.Validate() // url is required\n\n// after\nu, _ := url.Parse(\"http://ingestion-gateway:8080\")\ncfg := gateway.Config{URL: u}\nerr := cfg.Validate() // nil","handlingStrategy":"validation","validationCode":"raw := os.Getenv(\"SIGNOZ_INGESTION_GATEWAY_URL\")\nif raw == \"\" {\n    return fmt.Errorf(\"gateway URL env var is required\")\n}\nu, err := url.Parse(raw)\nif err != nil { return err }\ncfg := gateway.Config{URL: u}\nif err := cfg.Validate(); err != nil { return err }","typeGuard":"func hasGatewayURL(c gateway.Config) bool { return c.URL != nil }","tryCatchPattern":null,"preventionTips":["Fail fast at bootstrap when an integration's URL is unset","Document required env vars and validate them in a single startup check"],"tags":["config","gateway","validation","go"],"backgroundTag":"missing-config-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}