{"record":{"id":"c8ccd4deeea7179e","repo":"cloudflare/cloudflared","slug":"unable-to-create-a-new-logfile-s","errorCode":null,"errorMessage":"unable to create a new logfile: %s","messagePattern":"unable to create a new logfile: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"logger/create.go","lineNumber":251,"sourceCode":"\n\treturn singleFileInit.writer, singleFileInit.creationError\n}\n\nfunc createDirFile(config FileConfig) (io.Writer, error) {\n\tif config.Dirname != \"\" {\n\t\terr := os.MkdirAll(config.Dirname, dirPermMode)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to create directories for new logfile: %s\", err)\n\t\t}\n\t}\n\n\tmode := os.FileMode(filePermMode)\n\n\tfullPath := filepath.Join(config.Dirname, config.Filename)\n\tlogFile, err := os.OpenFile(fullPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, mode)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create a new logfile: %s\", err)\n\t}\n\n\treturn logFile, nil\n}\n\nfunc createRollingLogger(config RollingConfig) (io.Writer, error) {\n\trotatingFileInit.once.Do(func() {\n\t\tif err := os.MkdirAll(config.Dirname, dirPermMode); err != nil {\n\t\t\trotatingFileInit.creationError = err\n\t\t\treturn\n\t\t}\n\n\t\trotatingFileInit.writer = &lumberjack.Logger{\n\t\t\tFilename:   filepath.Join(config.Dirname, config.Filename),\n\t\t\tMaxBackups: config.maxBackups,\n\t\t\tMaxSize:    config.maxSize,\n\t\t\tMaxAge:     config.maxAge,\n\t\t}","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/logger/create.go#L233-L269","documentation":"Logger setup failure in createDirFile: after ensuring the directory exists, os.OpenFile could not open (create/append) the logfile at Dirname/Filename with the configured file mode — typically permission denied, the path is a directory, or the disk is full. File logging cannot proceed.","triggerScenarios":"Thrown at logger/create.go:251 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check write permission on the target logfile path for the running user.","Ensure the filename does not collide with an existing directory.","Free disk space or point logging at a writable volume."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}