stamparm/maltrail · error
write worker config
Error message
write worker config
What it means
Panic from `.expect("write worker config")` when `std::fs::write` fails to write the generated `worker.conf` containing MONITOR_INTERFACE, LOG_DIR and TRAILS_FILE lines. The worker context cannot proceed without its config file.
Solutions
- Check temp dir writability and free space
- Remove any non-file entry at the worker.conf path
- Set TMPDIR to a known-writable directory for test runs
- Match on the fs::write result to log the underlying io::Error
Defensive patterns
Strategy: try-catch
Validate before calling
assert!(dir.is_dir(), "temp dir must exist before writing worker.conf");
Try / catch
std::fs::write(&config_file, body).unwrap_or_else(|e| panic!("write worker config {}: {e}", config_file.display())); Prevention
- Check tmpfs size/quota in CI images
- Remove leftover worker.conf directories from crashed runs
- Log the io::Error with the full path on failure
When it happens
Trigger: `worker_context()` invoked while the temp filesystem is full, read-only, or the path worker.conf is occupied by a directory; permissions changed after dir creation.
Common situations: Containerized CI with small tmpfs; sandboxed environments blocking writes; leftover directory named worker.conf from a corrupted earlier run.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
AI-assisted analysis of stamparm/maltrail@77cfb06d76 (2026-09-13).
Data as JSON: /api/errors/690d0c291062ab7a.
Report an issue: GitHub.
Appendix: source
Thrown at sensor/src/testkit.rs:323
let config_file = dir.join("worker.conf");
std::fs::write(
&config_file,
format!(
"MONITOR_INTERFACE any\n\
CAPTURE_BUFFER 1MB\n\
PROCESS_COUNT 1\n\
UPDATE_PERIOD 999999999\n\
DISABLE_CHECK_SUDO true\n\
USE_CONDENSED_STORAGE false\n\
USE_HEURISTICS false\n\
SENSOR_NAME harness\n\
LOG_DIR {}\n\
TRAILS_FILE {}\n",
log_dir.display(),
trails_file.display()
),
)
.expect("write worker config");
let root = repo_root();
let mut cfg = Config::load(&config_file).expect("worker config must load");
cfg.root = root.clone();
settings::init(root);
crate::output::init_error_log(&log_dir, false);
crate::worker::WorkerContext {
id,
cfg: Arc::new(cfg),
whitelist: Arc::new(Whitelist::default()),
store: Arc::new(TrailStore::new(build_db(&[]))),
output: Arc::new(OutputConfig {
sensor_name: "harness".to_string(),
log_dir,
trails_file,
disable_local_log_storage: false,
local_log_json: false,View on GitHub (pinned to 77cfb06d76)