{"record":{"id":"5e593af7207e35fa","repo":"yamadashy/repomix","slug":"no-repomix-output-file-found-in-directory-input","errorCode":null,"errorMessage":"No repomix output file found in directory: ${inputPath}. Looking for: ${possibleFiles.join(', ')}","messagePattern":"No repomix output file found in directory: (.+?)\\. Looking for: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/mcp/tools/attachPackedOutputTool.ts","lineNumber":71,"sourceCode":"  try {\n    const stats = await fs.stat(inputPath);\n\n    if (stats.isDirectory()) {\n      // If it's a directory, look for repomix output files in priority order\n      const possibleFiles = Object.values(defaultFilePathMap);\n\n      for (const fileName of possibleFiles) {\n        const outputFilePath = path.join(inputPath, fileName);\n        try {\n          await fs.access(outputFilePath);\n          const format = getFormatFromFileName(fileName);\n          return { filePath: outputFilePath, format };\n        } catch {\n          // File doesn't exist, continue to next\n        }\n      }\n\n      throw new Error(\n        `No repomix output file found in directory: ${inputPath}. Looking for: ${possibleFiles.join(', ')}`,\n      );\n    }\n\n    // If it's a file, check if it's a supported format\n    const supportedExtensions = Object.values(defaultFilePathMap).map((file) => path.extname(file));\n    const fileExtension = path.extname(inputPath).toLowerCase();\n\n    if (!supportedExtensions.includes(fileExtension)) {\n      throw new Error(\n        `Unsupported file format: ${fileExtension}. Supported formats: ${supportedExtensions.join(', ')}`,\n      );\n    }\n\n    const format = getFormatFromExtension(fileExtension);\n    return { filePath: inputPath, format };\n  } catch (error) {\n    if (error instanceof Error && error.message.includes('ENOENT')) {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/mcp/tools/attachPackedOutputTool.ts#L53-L89","documentation":"This error is thrown by resolveOutputFilePath in the MCP attach-packed-output tool when the given inputPath is a directory that contains none of the repomix output files it knows how to attach (e.g. repomix-output.xml, repomix-output.md). The library scans the directory for files matching its default output file map and throws when no candidate exists, so it can refuse to attach a file it cannot parse.","triggerScenarios":"Calling the attach packed output MCP tool with a directory path that has no repomix output file in it, or where the output file was deleted/renamed, or where repomix was run with a custom --output filename that is not one of the recognized defaults.","commonSituations":"Developers run `repomix` with a custom output name (e.g. `--output bundle.xml`) then point the MCP tool at the directory; or they point the tool at the wrong directory (project root vs a subfolder); or the output was generated into a different location than expected.","solutions":["Run repomix in that directory first so a default-named output file (repomix-output.xml/md/json/txt) exists","Rename or copy your custom output file to a recognized default name (e.g. repomix-output.xml)","Pass the output file path directly (not the directory) with the correct format","Verify with `ls <dir>/repomix-output.*` that the file actually exists before calling the tool"],"exampleFix":"// before\nawait attachPackedOutput({ path: './my-project' }); // no repomix-output.* present\n// after\nawait $`repomix --output repomix-output.xml`; // generate first\nawait attachPackedOutput({ path: './my-project' });","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nconst candidates = ['repomix-output.xml','repomix-output.md','repomix-output.json','repomix-output.txt'];\nif (fs.statSync(inputPath).isDirectory() && !candidates.some(f => fs.existsSync(`${inputPath}/${f}`))) {\n  throw new Error(`No repomix output in ${inputPath}; run repomix first`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await attachPackedOutput({ path: inputPath });\n} catch (e) {\n  if (String(e.message).startsWith('No repomix output file found')) {\n    // run repomix or correct the path, then retry\n  } else throw e;\n}","preventionTips":["Always run `repomix` with a default output name before attaching","Use absolute paths and confirm with ls before calling the tool","Avoid custom --output names unless you pass the file path directly"],"tags":["mcp","file-not-found","filesystem"],"backgroundTag":"expected-file-missing","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}