{"record":{"id":"e02c174d1c574e1d","repo":"yamadashy/repomix","slug":"failed-to-compress-filepath-using-uncompressed","errorCode":null,"errorMessage":"Failed to compress ${filePath}, using uncompressed content: ${message}","messagePattern":"Failed to compress (.+?), using uncompressed content: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/core/treeSitter/parseFile.ts","lineNumber":122,"sourceCode":"    const mergedChunks = mergeAdjacentChunks(filteredChunks);\n\n    return mergedChunks\n      .map((chunk) => chunk.content)\n      .join(`\\n${CHUNK_SEPARATOR}\\n`)\n      .trim();\n  } catch (error: unknown) {\n    // Any failure here (language preparation, parsing, or a WASM runtime abort)\n    // degrades to uncompressed content instead of aborting the whole pack.\n    //\n    // Note on hard WASM aborts (e.g. \"table index is out of bounds\"): such an\n    // abort can leave this worker's shared tree-sitter runtime degraded. The\n    // parser singleton is reused for the worker's lifetime, so later files routed\n    // to the same worker may also fall back to uncompressed output. This is\n    // bounded per worker and surfaced by the warning below. Recovering the\n    // runtime would require recycling the worker, which is out of scope here; the\n    // init-failure path is already retried by getLanguageParserSingleton.\n    const message = error instanceof Error ? error.message : String(error);\n    logger.warn(`Failed to compress ${filePath}, using uncompressed content: ${message}`);\n    return undefined;\n  } finally {\n    tree?.delete();\n  }\n};\n\nconst getLanguageParserSingleton = async () => {\n  if (!languageParserSingleton) {\n    // Assign only after init() succeeds. Otherwise a failed init would leave an\n    // uninitialized parser cached for the rest of the worker's lifetime, so\n    // every subsequent file would throw \"not initialized\" and silently lose\n    // compression. Keeping the singleton null lets the next call retry init.\n    const parser = new LanguageParser();\n    await parser.init();\n    languageParserSingleton = parser;\n  }\n  return languageParserSingleton;\n};","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/treeSitter/parseFile.ts#L104-L140","documentation":"parseFile logs this warning when the Tree-sitter based compression step throws for a file; the function returns undefined so the caller packs the raw uncompressed content. If the failure came from a corrupted worker-local parser, later files on the same worker also fall back, as noted in the source comment.","triggerScenarios":"Tree-sitter parse or compress throws: WASM runtime corruption in a worker, unsupported/failed language init, malformed syntax crashing the parser, or a Tree-sitter node API error.","commonSituations":"Files with syntax exotic enough to break the grammar; a worker's parser singleton corrupted after an earlier init failure; language grammar/WASM version mismatches.","solutions":["Accept the fallback — output is uncompressed but correct; silence by disabling compression (remove compress option) if the warning is noisy.","Update repomix (and its tree-sitter language packages) to get grammar/runtime fixes.","Identify the file from the log and exclude it if its compression is not important.","If many files warn, restart the run — worker parser corruption is bounded per worker and a fresh process recovers it."],"exampleFix":"// before: compress everything, warns on exotic syntax\n\"output\": { \"compression\": true }\n// after: keep raw content for the problematic file\n\"ignore\": { \"customPatterns\": { \"**/weird.min.js\": true } }","handlingStrategy":"fallback","validationCode":"// confirm the grammar handles the file before enabling compression\nconst supported = ['.ts', '.tsx', '.js', '.py', ...];\nif (!supported.some(ext => filePath.endsWith(ext))) disableCompressionFor(filePath);","typeGuard":"const isCompressible = (ext, langs) => langs.some(l => l.extensions?.includes(ext));","tryCatchPattern":"const compressed = await parseFile(filePath, content, config).catch(() => undefined);\nconst out = compressed ?? content; // fall back to raw content","preventionTips":["Keep repomix and its tree-sitter grammar packages up to date.","Disable compression for minified or exotic-syntax files.","If warnings affect many files, rerun in a fresh process to reset corrupted workers."],"tags":["tree-sitter","compression","worker","fallback"],"backgroundTag":"tree-sitter-parse-failed","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}