{"record":{"id":"83c954aeabafd9d0","repo":"yamadashy/repomix","slug":"file-or-directory-not-found-for-path-inputpath","errorCode":null,"errorMessage":"File or directory not found for path: ${inputPath}","messagePattern":"File or directory not found for path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/mcp/tools/attachPackedOutputTool.ts","lineNumber":90,"sourceCode":"        `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')) {\n      throw new Error(`File or directory not found for path: ${inputPath}`, { cause: error });\n    }\n    throw error;\n  }\n}\n\n/**\n * Get format from file name\n */\nfunction getFormatFromFileName(fileName: string): string {\n  for (const [format, defaultFileName] of Object.entries(defaultFilePathMap)) {\n    if (fileName === defaultFileName) {\n      return format;\n    }\n  }\n  return 'xml'; // fallback\n}\n\n/**","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/mcp/tools/attachPackedOutputTool.ts#L72-L108","documentation":"This wraps any ENOENT (path does not exist) failure that escapes resolveOutputFilePath into a clearer message. It is thrown when the inputPath passed to the attach packed output tool is neither an existing file nor an existing directory.","triggerScenarios":"Calling the MCP attach tool with a path that was deleted, a typo'd path, a relative path resolved against a different working directory than expected, or a symlink pointing to a removed target.","commonSituations":"Hardcoded absolute paths that differ between machines/CI; running the MCP server from a different cwd than the CLI; case-sensitivity mismatches on Linux for paths authored on macOS/Windows.","solutions":["Check the path exists: `ls -la <inputPath>`; fix typos or stale paths","Use an absolute path to avoid cwd differences between CLI and MCP server","Regenerate the output or recreate the directory if it was deleted","Verify symlink targets exist if the path is a link"],"exampleFix":"// before\nawait attachPackedOutput({ path: './projct/repomix-output.xml' }); // typo\n// after\nawait attachPackedOutput({ path: '/abs/path/to/project/repomix-output.xml' });","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nif (!fs.existsSync(inputPath)) throw new Error(`Path does not exist: ${inputPath}`);","typeGuard":null,"tryCatchPattern":"try {\n  await attachPackedOutput({ path: inputPath });\n} catch (e) {\n  if (/File or directory not found|ENOENT/.test(e.cause?.code ?? e.message)) {\n    // fix the path (prefer absolute) and retry\n  } else throw e;\n}","preventionTips":["Use absolute paths independent of the MCP server's cwd","Regenerate outputs after cleaning build artifacts","Check symlink targets exist"],"tags":["mcp","enoent","filesystem"],"backgroundTag":"file-or-directory-not-found","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}