{"record":{"id":"314c6edd1cd5efb5","repo":"swc-project/swc","slug":"attempted-to-action-private-field-on-non-instan","errorCode":null,"errorMessage":"attempted to ${action} private field on non-instance","messagePattern":"attempted to (.+?) private field on non-instance","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_transforms_base/src/helpers/generated/_class_extract_field_descriptor.rs","lineNumber":11,"sourceCode":"// This file is generated by `cargo codegen helpers`. DO NOT MODIFY.\n\nuse super::{HelperDef, HelperName};\n\npub const DEF: HelperDef = HelperDef {\n    name: HelperName::class_extract_field_descriptor,\n    local: \"_class_extract_field_descriptor\",\n    import_path: \"@swc/helpers/_/_class_extract_field_descriptor\",\n    #[cfg(feature = \"inline-helpers\")]\n    source: r#\"function _class_extract_field_descriptor(receiver, privateMap, action) {\n    if (!privateMap.has(receiver)) throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n\n    return privateMap.get(receiver);\n}\n\"#,\n    #[cfg(feature = \"inline-helpers\")]\n    deps: super::HelperBitmap::from_bits(0x00000000000000000000000000400000),\n};\n\n#[cfg(feature = \"inline-helpers\")]\npub fn stmts() -> &'static [swc_ecma_ast::Stmt] {\n    static STMTS: once_cell::sync::Lazy<Vec<swc_ecma_ast::Stmt>> =\n        once_cell::sync::Lazy::new(|| super::super::parse(DEF.source, DEF.import_path));\n    &STMTS\n}\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_transforms_base/src/helpers/generated/_class_extract_field_descriptor.rs#L1-L26","documentation":"The input ended while the parser was in the Main phase, meaning the open-elements stack still had unclosed elements when EOF arrived. The parser records this recoverable error with the EOF span and switches to the End phase so trailing comments/PIs are still handled. The document is produced with elements that have no (matching) end span, so their spans fall back to child spans or the start span.","triggerScenarios":"Feeding a file that ends without closing the root element, e.g. `<root><child>` then EOF; a truncated stream where the closing tags were cut off; a lexer/fragment configuration that stops tokenizing before the document is complete.","commonSituations":"Truncated network reads or partial file writes (upload interrupted, log rotation mid-write); templating that conditionally skips closing tags; incremental streaming code that passes only the first chunk to the parser; version upgrades where a code path previously appended closing tags automatically.","solutions":["Check the tail of the input at the error span - it will point at the end of file, so the real problem is the last unclosed element; walk up from it and add the missing end tags.","Verify upstream producers write and flush the complete document (compare expected byte length, re-read the file after the writer closes).","If you are parsing chunks, buffer until the stream is complete or use a streaming parser designed for partial input.","After parsing, treat ErrorKind::UnexpectedEofInMainPhase as fatal for downstream consumers because element spans and end-tag spans are incomplete."],"exampleFix":"<!-- before: EOF while root/child still open -->\n<root>\n  <child>text\n\n<!-- after -->\n<root>\n  <child>text</child>\n</root>","handlingStrategy":"validation","validationCode":"use swc_xml_parser::error::ErrorKind;\n\nlet mut errors = Vec::new();\nlet doc = swc_xml_parser::parse_file_as_document(&fm, config, &mut errors)?;\nif errors\n    .iter()\n    .any(|e| matches!(e.kind(), ErrorKind::UnexpectedEofInMainPhase))\n{\n    return Err(\"input truncated: unclosed elements at EOF\".into());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Parse from fully-buffered input, not partial chunks; check Content-Length or file size stability before parsing.","Write documents atomically (temp file + rename) so readers never observe half-written XML.","In tests, assert that generated documents end with the root closing tag."],"tags":["xml","parser","eof","unclosed-tag","truncation","swc","recoverable"],"backgroundTag":"unclosed-element","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}