{"record":{"id":"2d2a1e8e91ec45e4","repo":"asciinema/asciinema","slug":"appending-to-asciicast-v1-files-is-not-supported","errorCode":null,"errorMessage":"appending to asciicast v1 files is not supported","messagePattern":"appending to asciicast v1 files is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/session.rs","lineNumber":246,"sourceCode":"        }\n\n        Ok((overwrite, append))\n    }\n\n    fn get_file_format(&self, path: &Path, append: bool) -> Result<Format> {\n        self.output_format.map(Ok).unwrap_or_else(|| {\n            let format_path = if is_zstd_path(path) {\n                path.with_extension(\"\")\n            } else {\n                path.to_owned()\n            };\n\n            if format_path.extension().is_some_and(|ext| ext == \"txt\") {\n                Ok(Format::Txt)\n            } else if append {\n                match asciicast::open_from_path(path) {\n                    Ok(cast) => match cast.version {\n                        Version::One => bail!(\"appending to asciicast v1 files is not supported\"),\n                        Version::Two => Ok(Format::AsciicastV2),\n                        Version::Three => Ok(Format::AsciicastV3),\n                    },\n\n                    Err(e) => bail!(\"can't append: {e}\"),\n                }\n            } else {\n                Ok(Format::AsciicastV3)\n            }\n        })\n    }\n\n    fn get_encoder(\n        &self,\n        format: Format,\n        path: &Path,\n        append: bool,\n    ) -> Result<Box<dyn Encoder + Send>> {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/asciinema/asciinema/blob/77498061982889f68ba1f6e8b666dd8d13246250/src/cmd/session.rs#L228-L264","documentation":"Raised by get_file_format when appending (--append) to an output file detected as asciicast v1. The v1 format is a single-line JSON document that cannot be appended to; only v2 (line-based) and v3 formats support appending. asciinema refuses rather than corrupting the file.","triggerScenarios":"Running a session with --append whose output file extension is not .txt, and asciicast::open_from_path parses it as Version::One.","commonSituations":"Appending to very old recordings made with legacy asciinema versions; files downloaded from old archives; mistakenly appending to a v1 cast produced by an old tool.","solutions":["Convert the v1 file to v2/v3 first (e.g. `asciinema convert`) then append","Record to a new file instead of appending","Upgrade the recording manually to the asciicast v2/v3 line format"],"exampleFix":"// before\n$ asciinema session --append old-v1.cast   // fails\n// after\n$ asciinema convert --overwrite old-v1.cast old-v1.cast\n$ asciinema session --append old-v1.cast","handlingStrategy":"validation","validationCode":"// Before appending, check the cast version:\nlet first = std::fs::read_to_string(\"old.cast\")?;\nif first.trim().starts_with('{') && serde_json::from_str::<serde_json::Value>(&first).is_ok() {\n    // v1 single-object JSON: convert to v2/v3 before appending\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Convert legacy v1 casts to v2/v3 before appending","Avoid reusing ancient recordings as append targets","Prefer v3 for all new recordings"],"tags":["cli","file-format","append","asciicast-v1"],"backgroundTag":"unsupported-file-format","analyzedSha":"77498061982889f68ba1f6e8b666dd8d13246250","analyzedAt":"2026-09-03T06:12:25.119Z","contentChangedAt":"2026-09-03T06:12:25.119Z","schemaVersion":2},"datasetVersion":"2026-09-10T12:17:11.382Z"}