{"record":{"id":"3f006f0ddc1fccb9","repo":"gleam-lang/gleam","slug":"writing-to-string-buffer-failed","errorCode":null,"errorMessage":"Writing to string buffer failed","messagePattern":"Writing to string buffer failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pretty-arena/src/lib.rs","lineNumber":375,"sourceCode":"            }\n            PrintableDocument::Join4(first, second, third, fourth) => {\n                first.is_empty() && second.is_empty() && third.is_empty() && fourth.is_empty()\n            }\n            // Zero-width strings don't count towards line length, but they are\n            // still printed and so are not empty. (Unless their string contents\n            // is also empty)\n            PrintableDocument::ZeroWidthString { string } => string.is_empty(),\n            PrintableDocument::ZeroWidthStr { string } => string.is_empty(),\n            PrintableDocument::CursorPositionObserver { .. } => true,\n        }\n    }\n\n    /// Prints a document into a `String`, attempting to limit lines to `limit`\n    /// characters in length.\n    pub fn to_pretty_string(self, limit: isize) -> String {\n        let mut buffer = String::new();\n        self.pretty_print(limit, &mut buffer)\n            .expect(\"Writing to string buffer failed\");\n        buffer\n    }\n\n    /// Prints a document into `writer`, attempting to limit lines to `limit`\n    /// characters in length.\n    pub fn pretty_print(self, limit: isize, writer: &mut impl std::fmt::Write) -> std::fmt::Result {\n        let docs = im::vector![(0, Mode::Unbroken, self)];\n        format(writer, limit, docs)?;\n        Ok(())\n    }\n}\n\n/// A pretty printable document. A tree structure, made up of text and other\n/// elements which determine how it can be formatted.\n///\n/// The variants of this enum should probably not be constructed directly,\n/// rather use the helper functions on the DocumentArena to construct them.\n///","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/gleam-lang/gleam/blob/7e623aa83da3776faee50ca4ab9a6c40124acd95/pretty-arena/src/lib.rs#L357-L393","documentation":"Error \"Writing to string buffer failed\" thrown in gleam-lang/gleam.","triggerScenarios":"Thrown at pretty-arena/src/lib.rs:375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7e623aa83da3776faee50ca4ab9a6c40124acd95","analyzedAt":"2026-08-17T00:07:02.091Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}