uutils/coreutils · error
trying to write to a split that was not created
Error message
trying to write to a split that was not created
What it means
Error "trying to write to a split that was not created" thrown in uutils/coreutils.
Source
Thrown at src/uu/csplit/src/csplit.rs:302
/// The current split will not keep any of the read input lines.
fn as_dev_null(&mut self) {
self.dev_null = true;
}
/// Writes the line to the current split.
/// If `self.dev_null` is true, then the line is discarded.
///
/// # Errors
///
/// Some [`io::Error`] may occur when attempting to write the line.
fn writeln(&mut self, line: &str) -> io::Result<()> {
if !self.dev_null {
if let Some(ref mut current_writer) = self.current_writer {
let bytes = line.as_bytes();
current_writer.write_all(bytes)?;
self.size += bytes.len();
} else {
panic!("{}", translate!("csplit-write-split-not-created"))
}
}
Ok(())
}
/// Perform some operations after completing a split, i.e., either remove it
/// if the [`options::ELIDE_EMPTY_FILES`] option is enabled, or print how much bytes were written
/// to it if [`options::QUIET`] is disabled.
///
/// # Errors
///
/// Returns an error if flushing the writer fails.
fn finish_split(&mut self) -> Result<(), CsplitError> {
if !self.dev_null {
// Flush the writer to ensure all data is written and errors are detected
if let Some(ref mut writer) = self.current_writer {
let file_name = self.options.split_name.get(self.counter - 1);View on GitHub (pinned to 9ff4114e82)
Solutions
- Create the split output file before writing to it; ensure the split counter is incremented only after a successful creation.
- Check available disk space and directory permissions so that creating a new split file cannot silently fail.
When it happens
Trigger: Occurs when csplit tries to write output to a split file that was never created, typically because the split pattern matched no input or an internal split counter advanced past created files.
Common situations: Using csplit with a regex or line-number pattern that matches beyond the end of input, or with repeat counts larger than the number of matches.
AI-assisted analysis of uutils/coreutils@9ff4114e82 (2026-08-19).
Data as JSON: /api/errors/2ee8d726c2fde6d0.
Report an issue: GitHub.