cloudflare/cloudflared · warning
ErrLogConfigurationIsInvalid
ErrLogConfigurationIsInvalid
Error message
provided log configuration is invalid
What it means
ErrLogConfigurationIsInvalid is returned by the host log collector's Collect when the log configuration parsed from the managed log directory cannot yield a usable setup. It is also declared as the error thrown when the log configuration itself is not collectible, per the diagnostic package's error table. Callers such as cmd/cloudflared/tunnel/subcommands.go check errors.Is against it to print actionable hints about containerized environments and the --no-diag-logs flag.
Source
Thrown at diagnostic/error.go:11
package diagnostic
import (
"errors"
)
var (
// Error used when there is no log directory available.
ErrManagedLogNotFound = errors.New("managed log directory not found")
// Error used when it is not possible to collect logs using the log configuration.
ErrLogConfigurationIsInvalid = errors.New("provided log configuration is invalid")
// Error used when parsing the fields of the output of collector.
ErrInsufficientLines = errors.New("insufficient lines")
// Error used when parsing the lines of the output of collector.
ErrInsuficientFields = errors.New("insufficient fields")
// Error used when given key is not found while parsing KV.
ErrKeyNotFound = errors.New("key not found")
// Error used when there is no disk volume information available.
ErrNoVolumeFound = errors.New("no disk volume information found")
// Error user when the base url of the diagnostic client is not provided.
ErrNoBaseURL = errors.New("no base url")
// Error used when no metrics server is found listening to the known addresses list (check [metrics.GetMetricsKnownAddresses]).
ErrMetricsServerNotFound = errors.New("metrics server not found")
// Error used when multiple metrics server are found listening to the known addresses list (check [metrics.GetMetricsKnownAddresses]).
ErrMultipleMetricsServerFound = errors.New("multiple metrics server found")
// Error used when a temporary file creation fails within the diagnostic procedure
ErrCreatingTemporaryFile = errors.New("temporary file creation failed")
)
View on GitHub (pinned to 2253eeeb25)
Solutions
- If the instance runs in a container, retry with --diag-container-id (Docker/containerd) or --diag-pod-id (Kubernetes) so logs are collected from the right environment.
- If you do not want log collection, pass --no-diag-logs to exclude the log collector entirely.
- Check the managed log directory for a valid log configuration file and restore it (restart the managed service to regenerate it).
- Match your cloudflared service setup to the expected managed configuration (service install rather than manual foreground run) and re-run diagnostics.
Example fix
// before: host diag fails against containerized instance cloudflared diag --output out.zip // after: target the container's log configuration cloudflared diag --output out.zip --diag-container-id <container-id> // or, if logs are not wanted at all: cloudflared diag --output out.zip --no-diag-logs
Defensive patterns
Strategy: try-catch
Validate before calling
// Go: inspect the log config before collecting
if cfg, err := collector.GetLogConfiguration(ctx); err != nil || cfg == nil {
// log configuration unusable; skip or use --no-diag-logs
} Type guard
func hasValidLogConfig(cfg *diagnostic.LogConfig) bool {
return cfg != nil
} Try / catch
_, err := collector.Collect(ctx)
switch {
case errors.Is(err, diagnostic.ErrLogConfigurationIsInvalid):
log.Info().Msg("no logging configuration; use --diag-container-id/--diag-pod-id or --no-diag-logs")
return
} Prevention
- Match diagnostics flags to the runtime environment (container/pod vs host).
- Explicitly disable log collection with --no-diag-logs when none is wanted.
- Ensure the managed service has generated a valid log configuration before collecting.
- Use errors.Is against the sentinel rather than string comparison.
When it happens
Trigger: Calling LogCollector.Collect on the host when getServiceLogPath succeeds but the returned log configuration is invalid — specifically the `return nil, ErrLogConfigurationIsInvalid` fallthrough at diagnostic/log_collector_host.go:102, reached when the configuration found for the current OS cannot be used for collection (e.g. no valid log source or no log configuration section present).
Common situations: Diagnostics run against a containerized instance whose log configuration differs from the host's (missing logging configuration in the container); a managed log directory exists but contains no valid log configuration file; Kubernetes pods where the collector looks at the host config instead of the pod's; users who intentionally run without log collection but still invoke diagnostics.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06).
Data as JSON: /api/errors/886b8913588cb893.
Report an issue: GitHub.