cloudflare/cloudflared · error

possible conflicting configuration in %[1]s and %[2]s. Eithe

Error message

possible conflicting configuration in %[1]s and %[2]s. Either remove %[2]s or run `cloudflared --config %[2]s service install`

What it means

Thrown by buildArgsForConfig when installing the service with a --config file that differs from the canonical service config path (/etc/cloudflared/config.yml) while that path already exists (or its existence check errors). Two configs would conflict — the service unit always points at /etc/cloudflared/config.yml, so the installer refuses to create an ambiguous setup and tells you to remove the stale file or install using that exact path.

Source

Thrown at cmd/cloudflared/linux_service.go:336

		return nil, err
	}

	src, _, err := config.ReadConfigFile(c, log)
	if err != nil {
		return nil, err
	}

	// can't use context because this command doesn't define "credentials-file" flag
	configPresent := func(s string) bool {
		val, err := src.String(s)
		return err == nil && val != ""
	}
	if src.TunnelID == "" || !configPresent(tunnel.CredFileFlag) {
		return nil, fmt.Errorf("configuration file %s must contain entries for the tunnel to run and its associated credentials (tunnel: TUNNEL-UUID, credentials-file: CREDENTIALS-FILE)", src.Source())
	}
	if src.Source() != serviceConfigPath {
		if exists, err := config.FileExists(serviceConfigPath); err != nil || exists {
			return nil, fmt.Errorf("possible conflicting configuration in %[1]s and %[2]s. Either remove %[2]s or run `cloudflared --config %[2]s service install`", src.Source(), serviceConfigPath)
		}

		if err := copyFile(src.Source(), serviceConfigPath); err != nil {
			return nil, fmt.Errorf("failed to copy %s to %s: %w", src.Source(), serviceConfigPath, err)
		}
	}

	return []string{
		"--config", "/etc/cloudflared/config.yml", "tunnel", "run",
	}, nil
}

func installSystemd(templateArgs *ServiceTemplateArgs, autoUpdate bool, log *zerolog.Logger) error {
	var systemdTemplates []ServiceTemplate
	if autoUpdate {
		systemdTemplates = []ServiceTemplate{
			systemdAllTemplates[cloudflaredService],
			systemdAllTemplates[cloudflaredUpdateService],

View on GitHub (pinned to 2253eeeb25)

Solutions

  1. Remove or rename the stale /etc/cloudflared/config.yml, then re-run `cloudflared --config <your-config> service install` (the installer will copy your config there).
  2. Or simply run `cloudflared --config /etc/cloudflared/config.yml service install` to use the existing file at the canonical path.
  3. Edit /etc/cloudflared/config.yml directly if it already holds the desired tunnel/credentials entries.
  4. Check that config.FileExists is not failing due to permissions on /etc/cloudflared (run the install with root/sudo).

Example fix

# before
$ cloudflared --config ~/myconfig.yml service install
# ERROR: possible conflicting configuration in /home/user/myconfig.yml and /etc/cloudflared/config.yml

# after
$ sudo rm /etc/cloudflared/config.yml
$ sudo cloudflared --config ~/myconfig.yml service install
Defensive patterns

Strategy: validation

Validate before calling

// Go: check for a conflicting service config before installing
serviceConfigPath := "/etc/cloudflared/config.yml"
if myConfigPath != serviceConfigPath {
    exists, err := config.FileExists(serviceConfigPath)
    if err != nil {
        return fmt.Errorf("cannot stat %s: %w", serviceConfigPath, err)
    }
    if exists {
        return fmt.Errorf("remove %s or install with --config %s", serviceConfigPath, serviceConfigPath)
    }
}

Try / catch

// Go
out, err := exec.Command("cloudflared", "--config", cfg, "service", "install").CombinedOutput()
if err != nil && strings.Contains(string(out), "possible conflicting configuration") {
    // remove /etc/cloudflared/config.yml or reinstall against that exact path
}

Prevention

When it happens

Trigger: `cloudflared --config /home/user/myconfig.yml service install` when /etc/cloudflared/config.yml already exists (e.g. from a previous install or package default), or when config.FileExists(serviceConfigPath) returns an error.

Common situations: Re-installing the service after previously installing with a different config; leftover /etc/cloudflared/config.yml from an old cloudflared version or manual setup; running service install as a different user pointing at a personal config while a system config remains.

Related errors


AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06). Data as JSON: /api/errors/8698d662e6f775c3. Report an issue: GitHub.