{"record":{"id":"886b8913588cb893","repo":"cloudflare/cloudflared","slug":"errlogconfigurationisinvalid","errorCode":"ErrLogConfigurationIsInvalid","errorMessage":"provided log configuration is invalid","messagePattern":"provided log configuration is invalid","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"diagnostic/error.go","lineNumber":11,"sourceCode":"package diagnostic\n\nimport (\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":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/diagnostic/error.go#L1-L29","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before: host diag fails against containerized instance\ncloudflared diag --output out.zip\n\n// after: target the container's log configuration\ncloudflared diag --output out.zip --diag-container-id <container-id>\n// or, if logs are not wanted at all:\ncloudflared diag --output out.zip --no-diag-logs","handlingStrategy":"try-catch","validationCode":"// Go: inspect the log config before collecting\nif cfg, err := collector.GetLogConfiguration(ctx); err != nil || cfg == nil {\n    // log configuration unusable; skip or use --no-diag-logs\n}","typeGuard":"func hasValidLogConfig(cfg *diagnostic.LogConfig) bool {\n    return cfg != nil\n}","tryCatchPattern":"_, err := collector.Collect(ctx)\nswitch {\ncase errors.Is(err, diagnostic.ErrLogConfigurationIsInvalid):\n    log.Info().Msg(\"no logging configuration; use --diag-container-id/--diag-pod-id or --no-diag-logs\")\nreturn\n}","preventionTips":["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."],"tags":["diagnostics","logs","configuration","cloudflared"],"backgroundTag":"invalid-config-value","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"}