{"record":{"id":"cafdb240eff9c37a","repo":"cloudflare/cloudflared","slug":"no-configuration-file-was-found-please-create-one","errorCode":null,"errorMessage":"No configuration file was found. Please create one, or use the --config flag to specify its filepath. You can use the help command to learn more about configuration files","messagePattern":"No configuration file was found\\. Please create one, or use the --config flag to specify its filepath\\. You can use the help command to learn more about configuration files","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/ingress_subcommands.go","lineNumber":113,"sourceCode":"\t\tfmt.Println(\"Warning: unused keys detected in your config file. Here is a list of unused keys:\")\n\t\tfmt.Println(warnings)\n\t\treturn nil\n\t}\n\tfmt.Println(\"OK\")\n\treturn nil\n}\n\nfunc getConfiguration(c *cli.Context) (*config.Configuration, error) {\n\tvar conf *config.Configuration\n\tif c.IsSet(ingressDataJSONFlagName) {\n\t\tingressJSON := c.String(ingressDataJSONFlagName)\n\t\tfmt.Println(\"Validating rules from cmdline flag --json\")\n\t\terr := json.Unmarshal([]byte(ingressJSON), &conf)\n\t\treturn conf, err\n\t}\n\tconf = config.GetConfiguration()\n\tif conf.Source() == \"\" {\n\t\treturn nil, errors.New(\"No configuration file was found. Please create one, or use the --config flag to specify its filepath. You can use the help command to learn more about configuration files\")\n\t}\n\tfmt.Println(\"Validating rules from\", conf.Source())\n\treturn conf, nil\n}\n\n// testURLCommand checks which ingress rule matches the given URL.\nfunc testURLCommand(c *cli.Context) error {\n\trequestArg := c.Args().First()\n\tif requestArg == \"\" {\n\t\treturn errors.New(\"cloudflared tunnel rule expects a single argument, the URL to test\")\n\t}\n\n\trequestURL, err := url.Parse(requestArg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s is not a valid URL\", requestArg)\n\t}\n\tif requestURL.Hostname() == \"\" && requestURL.Scheme == \"\" {\n\t\treturn fmt.Errorf(\"%s doesn't have a hostname, consider adding a scheme\", requestArg)","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/ingress_subcommands.go#L95-L131","documentation":"getConfiguration, used by ingress validation commands, requires a config file. If `--json` was not provided and config.GetConfiguration() reports an empty source, cloudflared cannot load ingress rules and throws this error. Ingress rules are only sourced from a config file or --json blob, so one must exist.","triggerScenarios":"Running `cloudflared tunnel ingress validate` (or related ingress commands) with no config file at any default location and no --config/--json flag.","commonSituations":"Running the ingress subcommand outside a directory with config.yml; misnamed file (config.yaml vs config.yml); typo in --config path; first-time setup before creating a config.","solutions":["Create a configuration file at a default location (e.g. /etc/cloudflared/config.yml or ~/.cloudflared/config.yml).","Pass --config explicitly: `cloudflared tunnel --config /path/to/config.yml ingress validate`.","Alternatively validate rules from an inline blob with --json instead of a file."],"exampleFix":"// before\ncloudflared tunnel ingress validate\n// after\ncloudflared tunnel --config /etc/cloudflared/config.yml ingress validate","handlingStrategy":"validation","validationCode":"if [ ! -f \"$CONFIG\" ]; then echo \"config file $CONFIG not found\" >&2; exit 1; fi\ncloudflared tunnel --config \"$CONFIG\" ingress validate","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --config explicitly in scripts instead of relying on default search paths.","Keep the config at a standard location (/etc/cloudflared/config.yml).","Check file existence and spelling (yml vs yaml) before running ingress commands."],"tags":["cli","configuration","ingress","file"],"backgroundTag":"config-file-not-found","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"}