{"record":{"id":"5f8ec00fc2dbfeb1","repo":"risingwavelabs/risingwave","slug":"failed-to-create","errorCode":null,"errorMessage":"failed to create `{}`: {}","messagePattern":"failed to create `(.+?)`: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/utils/runtime/src/logger.rs","lineNumber":411,"sourceCode":"                fields: R,\n            ) -> std::fmt::Result {\n                self.0.format_fields(writer, fields)\n            }\n        }\n\n        for (file_name, target, is_slow) in [\n            (\"query.log\", PGWIRE_QUERY_LOG, false),\n            (\"slow_query.log\", PGWIRE_SLOW_QUERY_LOG, true),\n        ] {\n            let path = query_log_path.join(file_name);\n\n            let file = std::fs::OpenOptions::new()\n                .create(true)\n                .write(true)\n                .truncate(true)\n                .open(&path)\n                .unwrap_or_else(|e| {\n                    panic!(\"failed to create `{}`: {}\", path.display(), e.as_report(),)\n                });\n\n            let layer = tracing_subscriber::fmt::layer()\n                .with_ansi(false)\n                .with_level(false)\n                .with_file(false)\n                .with_target(false)\n                .with_timer(default_timer.clone())\n                .with_thread_names(true)\n                .with_thread_ids(true)\n                .with_writer(file);\n\n            let layer = match is_slow {\n                true => layer.fmt_fields(FmtFields::<true>::default()).boxed(),\n                false => layer.fmt_fields(FmtFields::<false>::default()).boxed(),\n            };\n\n            let layer = layer.with_filter(","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/utils/runtime/src/logger.rs#L393-L429","documentation":"init_risingwave_logger opens the query-log file with OpenOptions (create+write+truncate) and panics on failure, reporting the path and OS error. This happens after directory creation succeeds, so failures here are about writing/opening the log file itself.","triggerScenarios":"The resolved log file path cannot be opened: no write permission on the file or directory, disk full (io error), the path is a directory, or a name/length issue on the target filesystem.","commonSituations":"File exists but is owned by another user with read-only mode; path component is a directory; ENOSPC on full disks; SELinux/AppArmor blocking file creation in that directory.","solutions":["Ensure the directory is writable by the process user (chmod/chown) and the path points to a file, not a directory.","Free disk space if ENOSPC is reported.","Remove a stale read-only log file so it can be recreated.","Unset RW_QUERY_LOG_PATH to disable file-based query logging."],"exampleFix":"// before: file owned by root, mode 0444\n-r--r--r-- query.log\n// after\nsudo chown risingwave:risingwave query.log && chmod 0644 query.log","handlingStrategy":"validation","validationCode":"use std::path::Path;\nlet p = std::env::var(\"RW_QUERY_LOG_PATH\").unwrap_or_default();\nlet dir = Path::new(&p);\nassert!(dir.is_dir(), \"RW_QUERY_LOG_PATH must be an existing writable directory\");\nassert!(dir.permissions().readonly() == false, \"RW_QUERY_LOG_PATH is read-only\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the process as a user with write access to the log directory.","Monitor disk space; ENOSPC will break log file creation.","Keep log files out of directories managed by other services or security policies."],"tags":["rust","logging","filesystem","file-open","permissions"],"backgroundTag":"file-open-failed","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}