{"record":{"id":"3613780fb51c81a7","repo":"openai/codex","slug":"failed-to-register-protected-create-target-er","errorCode":null,"errorMessage":"failed to register protected create target {}: {err}","messagePattern":"failed to register protected create target (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/linux_run_main.rs","lineNumber":1010,"sourceCode":"}\n\nfn register_protected_create_targets(\n    targets: &[crate::bwrap::ProtectedCreateTarget],\n) -> Vec<ProtectedCreateTargetRegistration> {\n    with_synthetic_mount_registry_lock(|| {\n        targets\n            .iter()\n            .map(|target| {\n                let marker_dir = synthetic_mount_marker_dir(target.path());\n                fs::create_dir_all(&marker_dir).unwrap_or_else(|err| {\n                    panic!(\n                        \"failed to create protected create marker directory {}: {err}\",\n                        marker_dir.display()\n                    )\n                });\n                let marker_file = marker_dir.join(std::process::id().to_string());\n                fs::write(&marker_file, PROTECTED_CREATE_MARKER).unwrap_or_else(|err| {\n                    panic!(\n                        \"failed to register protected create target {}: {err}\",\n                        target.path().display()\n                    )\n                });\n                ProtectedCreateTargetRegistration {\n                    target: target.clone(),\n                    marker_file,\n                    marker_dir,\n                }\n            })\n            .collect()\n    })\n}\n\nfn synthetic_mount_marker_contents(target: &crate::bwrap::SyntheticMountTarget) -> &'static [u8] {\n    if target.preserves_pre_existing_path() {\n        SYNTHETIC_MOUNT_MARKER_EXISTING\n    } else {","sourceCodeStart":992,"sourceCodeEnd":1028,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/linux_run_main.rs#L992-L1028","documentation":"register_protected_create_targets writes a per-PID marker file containing PROTECTED_CREATE_MARKER so concurrent processes can tell who owns a protected-create registration and cleanup can distinguish owners. fs::write panics on storage failures after the directory was just created: ENOSPC, EDQUOT, EIO, or the marker dir vanishing between create and write despite the cross-process flock.","triggerScenarios":"Sandboxed runs with protected-create targets whose temp filesystem fills (sized tmpfs) or errors during run setup, right after the marker directory was created.","commonSituations":"Parallel sessions exhausting tmpfs; disk-full runners; failing storage; quota limits hit mid-write.","solutions":["Free or enlarge the filesystem backing TMPDIR, then retry the command.","Verify the marker dir path from the panic still exists and is writable.","Check dmesg and SMART for I/O errors when space is fine.","Clear the registry with all sessions stopped if the state looks damaged."],"exampleFix":"# before: /tmp tmpfs sized too small for parallel protected-create runs\nmount -t tmpfs -o size=256m tmpfs /tmp\n\n# after: adequate headroom\nmount -t tmpfs -o size=2g tmpfs /tmp","handlingStrategy":"validation","validationCode":"fn temp_free_bytes(min: u64) -> bool {\n    let dir = std::env::temp_dir().canonicalize().unwrap_or_default();\n    let c = std::ffi::CString::new(dir.as_os_str().as_encoded_bytes()).unwrap_or_default();\n    let mut st: libc::statvfs = unsafe { std::mem::zeroed() };\n    unsafe { libc::statvfs(c.as_ptr(), &mut st) } == 0 && (st.f_bavail as u64) * (st.f_bsize as u64) >= min\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Monitor free space on the filesystem backing TMPDIR.","Size tmpfs mounts for peak concurrent protected-create registrations.","Check dmesg and SMART when writes fail without ENOSPC."],"tags":["sandbox","protected-create","marker-file","enospc","tmpfs","write-failure"],"backgroundTag":"no-space-left-on-device","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}